ENGLISH

Practical System Programming with C: Pragmatic Example Applications in Linux and Unix-Based Operating Systems

Book information

Publisher
Apress
Year
2020
ISBN
1484263200, 9781484263204
Language
english
Format
PDF
Filesize
9 MB (9211290 bytes)
Edition
1
Pages
292\286
Time added
2021-10-01 12:57:35

Description

This book teaches system programming with the latest versions of C through a set of practical examples and problems. It covers the development of a handful of programs, implementing efficient coding examples.   Practical System Programming with C contains three main parts: getting your hands dirty with multithreaded C programming; practical system programming using concepts such as processes, signals, and inter-process communication; and advanced socket-based programming which consists of developing a network application for reliable communication.  You will be introduced to a marvelous ecosystem of system programming with C, from handling basic system utility commands to communicating through socket programming. With the help of socket programming you will be able to build client-server applications in no time.  The “secret sauce” of this book is its curated list of topics and solutions, which fit together through a set of different pragmatic examples; each topic is covered from scratch in an easy-to-learn way. On that journey, you’ll focus on practical implementations and an outline of best practices and potential pitfalls. The book also includes a bonus chapter with a list of advanced topics and directions to grow your skills.  What You Will Learn Program with operating systems using the latest version of C Work with Linux Carry out multithreading with C Examine the POSIX standardsWork with files, directories, processes, and signals Explore IPC and how to work with it Who This Book Is For  Programmers who have an exposure to C programming and want to learn system programming. This book will help them to learn about core concepts of operating systems with the help of C programming. .   Table of Contents About the Author Acknowledgments Introduction Chapter 1: Introduction to the Linux Environment Getting Familiar with the Linux Architecture Hardware Layer Kernel I/O Management Process Management Resource Management Device Management Types of Kernels Monolithic Kernels Microkernels Kernel Space User Space Hybrid Kernels Nanokernels Exokernels Shell System Library Linux Kernels vs. Other OS Kernels Introduction to Files Text File Program File Binary File Special File Regular File File Handling Utilities mkdir cd rmdir rm touch ls cat head tail nl wc copy ulimit File Permission Commands chmod Read Write Execute Changing Permissions with Weights Process Utilities Process Foreground Process Background Process Process Commands ps Options top kill Network Utilities ifconfig hostname netstat nslookup traceroute host ping dig Summary Chapter 2: Multithreading in C Introduction to Threads Thread Classification User-Level Threads Kernel-Level Threads Threads vs. Processes New State Ready State Wait State Running State Terminated Introduction to Multithreading Multitasking Architecture Multithreading Architecture Importance of Multithreading Efficient Resource Sharing Application Scalability Responsiveness Efficient Memory Utilization Efficient CPU Utilization Concurrency Parallelism Support of Multithreading in C pthread_create pthread_join pthread_self pthread_equal pthread_exit pthread_cancel pthread_detach Creating Threads Practical Examples of Multithreading Thread Termination Thread Equal Property Passing a Single Argument to a Thread Function Passing Multiple Arguments as Parameters The Relationship Between Threads and the CPU Multithreading Use Cases Summary Chapter 3: Introduction to POSIX Standards and System-Level APIs Understanding POSIX Standards POSIX.1 Standards POSIX.1b Standards POSIX.1c Standards POSIX.2 Standards POSIX Support Introduction to APIs User Mode Supervisor Mode The Importance of System-Level APIs Built-in APIs in C Summary Chapter 4: Files and Directories File Systems File Metadata and Inodes System Calls and I/O Operations for Files creat open close read write Append Operations in Files Using System Calls File Permissions chmod Function to Change Permissions File Permissions Check Soft and Hard Links Soft Links Creating a Soft Link Using the Command Line Unlinking a Soft Link Creating a Soft Link Using System Calls Unlinking Using a System Call Hard Links Creating a Hard Link Using the Command Line Creating a Hard Link Using a System Call System Calls for Directories Creating a Directory Deleting a Directory Getting the Current Working Directory Changing Directory Reading a Directory Closing a Directory Summary Chapter 5: Process and Signals Introduction to the Process Environment Environment List Memory Layout of a C Program Command-Line Arguments Stack Heap Uninitialized Data Initialized Data Text Process Termination Methodologies Environment Variables User-Level Environment Variables System-Level Environment Variable Environment Variable Examples Accessing an Environment Variable Setting a New Environment Variable Deleting Environment Variables Accessing Environment Variables in C Setting a New Environment Variable Using C Deleting an Environment Variable Kernel Support for Processes Process Scheduler Preemptive Scheduling Algorithm Non-Preemptive Scheduling Algorithm Memory Manager Virtual File System Network Unit Process Creation Zombie Process Orphan Process System Calls for Process Management vfork System Call exec System Call Family execl() execlp() execle() execv() execvp() execve() wait System Call waitpid System Call kill System Call exit System Call _Exit System Call Introduction to Signals Catch the Signal Ignore the Signal Default Action Types of Signals Unreliable Signals Reliable Signals System Calls for Signals raise System Call kill System Call alarm System Call pause System Call abort System Call sleep System Call Summary Chapter 6: Interprocess Communication Introduction to IPC Independent Processes Cooperating Processes Shared Memory Message Passing The Benefits of IPC Modes of Communication Simplex Half Duplex Full Duplex Types of IPC Pipes FIFO (Named Pipe) Message Queues Semaphores Shared Memory Sockets Anonymous Pipes APIs for Anonymous Pipes pipe() close() write() read() Creating Anonymous Pipes Implementation of Pipes Using Child and Parent Processes Working with Named Pipes mknod() System Call Dev mkfifo() System Call mknod vs. mkfifo Creating FIFO FIFO Server FIFO Client Using Message Queues APIs for Message Queues ftok() msgget() msgsnd() Message Type Message Text msgrcv() msgctl() Message Queue Implementation Introduction to Semaphores Binary Semaphores Counting Semaphores Characteristics of Semaphores The Advantages of Using a Semaphore The Disadvantages of Using a Semaphore Semaphore vs. Mutex APIs for a Semaphore semget() semop() semctl() Accessing Global Data Without Semaphores Implementing the Data Consistent Model Using a Semaphore and a Mutex Summary Chapter 7: Shared Memory Introduction to Shared Memory API for Shared Memory shmget() shmat() shmdt() shmctl() Kernel Support for Shared Memory Implementation of Shared Memory Shared Memory Writers Program Shared Memory Reader Program Summary Chapter 8: Socket Programming Introduction to Sockets Stream Sockets Datagram Sockets Raw Sockets Domain Sockets Internet Domain Sockets IPC Over Network Communication Style Namespaces Protocol API for Socket Programming OSI Architecture Model Physical Layer Data Link Layer Network Layer Transport Layer Session Layer Presentation Layer Application Layer Advantages of the OSI Model Disadvantages of the OSI Model TCP/IP Architecture Model Network Access Layer Internet Layer Transport Layer Application Layer Advantages of TCP/IP Disadvantages of TCP/IP Client-Server Architecture Client Server Examining the Client-Server Architecture Advantages of the Client-Server Model Disadvantages of the Client-Server Model System Calls for Socket Programming socket() bind() listen() accept() send() recv() sendto() recvfrom() close() Implementation of Client Server Architecture TCP Client-Server Architecture TCP Server TCP Client TCP Client-Server Code Server Code Client Code UDP Client Server Architecture UDP Server UDP Client UDP Client-Server Code Server Code Client Code Summary Index

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF