Processes

Cards (14)

  • In C, the fork() command is used to create a process. The fork() returns a 0 in the child process and some number greater than 0 in the parent process. This is number is a PID and is used to identify the different processes.
  • In C, the exit() function ends the process immediately.
  • The call of exit(0) indicates that the process terminated normally. A nonzero value indicates an error.
  • In addition to the typical executable object file, there is some additional virtual memory allocated for the process control block (PCB).
  • When new processes are created, a pointer to its process control block exists in the process table.
  • The wait() function indicates a state change in a child process.
  • All processes are assigned a process identifier or PID.
  • The operating system has two modes: user mode and kernel mode.
  • User mode provides restricted access to system resources. In order for a program perform kernel operations such as memory management, process scheduling and file management, it must use API's or system calls.
  • Kernel mode allows for direct access to all system resources. The operating system kernel operates in kernel mode, since it needs to keep track of the CPU context of a process. In kernel mode, the OS can directly access the hardware components, schedule processes, handle interrupts, and manage memory.
  • A system call is a command to hardware devices. It is a kernel mode privilege.
  • When an exception occurs, the CPU transfers control to the Operating system. The OS has an exception table and a designated handler for each exception. A handler is a set of instructions.
  • There are 3 types of synchronous exceptions: Traps, Faults, and Aborts. Asynchronous exceptions occur due to external circumstances, but synchronous exceptions are due to an event within the CPU. Usually, they are predictable.
  • A system call is a special instruction that transfers the CPU to kernel mode. System calls are traps that can be used to interrupt the execution of a program synchronously. File manipulation operations, process creation, and process termination are system calls that require the CPU to be in kernel mode.