From man page of fork in linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fork creates a child process that differs from the parent process only in its PID and PPID, and in the fact that resource utilizations are set to 0. File locks and pending signals are not inherited.
Under Linux, fork is implemented using copy-on-write pages, so the only penalty incurred by fork is the time and memory required to duplicate the parent's page tables, and to create a unique task structure for the child.
RETURN VALUE
On success, the PID of the child process is returned in the parent's thread of execution, and a 0 is returned in the child's thread of execution.
On failure, a -1 will be returned in the parent's context, no child process will be created, and errno will be set appropriately.
ERRORS
EAGAIN fork cannot allocate sufficient memory to copy the parent's page tables and allocate a task structure for the child.
ENOMEM fork failed to allocate the necessary kernel structures because memory is tight.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Blog Archive
-
▼
2007
(55)
-
▼
Apr
(48)
- Socket Programming
- Pthreads
- Virtual Memory Management
- How a system call is implemented?
- Inter-process communication
- How malloc has been implemented (brk system call)?
- Linux Modules - How are they linked dynamically?
- Proc File System
- fork, vfork, copy-on-write and clone
- CPU Scheduling -- Different types of CPU schedulin...
- Signals (System V and POSIX)
- How mapping from virtual address address to physic...
- setuid program (real and effective user ids)
- Exceptions, traps, interrupts and signals
- Processor execution levels
- Process Address Space
- Unix/Linux File System Layout
- Salient points about Unix/Linux
- Big Endian versus Little Endian
- Semaphore, Mutex, Conditional variable, Spin lock
- Segmentation Fault and Bus Error
- wait() system call
- Bottom half
- Linux time keeping - Timer interrupt, jiffies, xtime
- Position Independent Code (PIC)
- kmalloc/kfree and vmalloc/vfree
- Static versus shared objects
- How many processes will be created-- fork?
- Can we get return value from exec system call?
- How does profiling code works? -- processor debug ...
- ptrace - how does it work?
- Record locking
- GNU Linux pthreads
- How do you use RSA for both authentication and sec...
- Unix/Linx bootupand login
- What are various problems unique to distributed da...
- cooperative,preemption,non preemption
- Puzzles
- Write system call that prints stack trace at that ...
- DMA (Direct Memory Access)
- Real Time Systems
- Comparison of IOS and General Purpose OS like Linux
- Operating Systems I/O Structure
- Linux - Process Scheduling
- Deadlock avoidance and prevention
- Porting from 32 bit OS to 64 bit OS
- Sign extension
- How to make an application daemon
-
▼
Apr
(48)
No comments:
Post a Comment