Differences

This shows you the differences between two versions of the page.

Link to this comparison view

the_linux_programming_interface [2013/04/14 22:56]
jongbor [Processes]
the_linux_programming_interface [2014/04/19 15:41] (current)
Line 125: Line 125:
 **Daemons** are long lived processes that run on background. **Daemons** are long lived processes that run on background.
  
-Each process has an **environment list** (a set of keys and values) which are inherited on fork(). It can also be replaced via exec(). The environment can be read from the external variable char** environ (//​depending of the platform, this can be passed as the third parameter of main//).+Each process has an **environment list** (a set of keys and values) which are inherited on fork(). It can also be replaced via exec(). The environment can be read from the external variable ​%%char** environ%% (//​depending of the platform, this can be passed as the third parameter of main//).
  
 Processes are also given limits on the resources they can use (open files, memory, CPU). This is done calling setrlimit(). These values are inherited when fork()'​ing. Resource limits in the shell are set using ulimit. Processes are also given limits on the resources they can use (open files, memory, CPU). This is done calling setrlimit(). These values are inherited when fork()'​ing. Resource limits in the shell are set using ulimit.
 +
 +==== Memory Mappings ====
 +
 +A file can be mapped to a process'​ virtual memory.
 +
 +Mappings can be shared with mappings in other processes if they map to the same file of if one process inherits the mapping from its parent.
 +
 +Mappings can be private (changes not visible) or shared.
 +
 +Mappings are useful to store the text segment of a process, file I/O and interprocess communication.
 +
 +==== Static and Shared Libraries ====
 +
 +Static: linked into binary. Takes up memory. Shared: one copy of the library for all.
 +
 +==== Interprocess Communication and Synchronization ====
 +
 +Many mechanisms: signals, pipes, sockets, file locking (file regions can be locked to prevent other processes from reading or writing), message queues, semaphores, shared memory.
 +
 +==== Signals ====
 +
 +Signals inform a process that an event has occurred.
 +
 +Signals are sent by the kernel, by another process or the process itself.
 +
 +The kill command and kill() functions are used to send signals.
 +
 +A process can ignore a signal, be killed by the signal or be suspended until it receives a special signal. It can also establish a signal handler.
 +
 +A process in the process'​ //signal mask// gets blocked. ​
 +
 +==== Threads ====
 +
 +A process can have multiple threads of execution, all of which share the same data area and heap, but with different stacks.
 +
 +Threads can communicate via global variables and synchronize using condition variables and mutexes.
 +
 +==== Process Groups and Shell Job Control ====
 +
 +==== Sessions, Controlling Terminals, Controlling Processes ====
 +
 +==== Pseudoterminals ====
 +
 +==== Date and Time ====
 +
 +==== Client-Server Architecture ====
 +
 +==== Realtime ====
 +
 +==== The /proc File System ====
 +
 ===== Chapter 3: System Programming Concepts ===== ===== Chapter 3: System Programming Concepts =====
 +
  
 ===== Chapter 4: File I/O: the Universal I/O Model ===== ===== Chapter 4: File I/O: the Universal I/O Model =====