Processes

In this module, we will learn about processes and process management. A process is an instance of an executing program and process management is a key component of a multiprogramming OS. The OS needs to able to start and shutdown processes, and to manage processes that are already started. The OS exposes this functionality via a number of system calls and C functions. In this module, we will learn the fundamental concepts about processes and learn the OS API that allows us to create, terminate and manage processes. Additionally, we will explore the fundamentals of inter-process communication using signals, shared files, and redirection, in the context of a command-line shell.

Module Learning Outcomes

After successful completion of this module, you should be able to

  1. Explain the process abstraction and its centrality for multi-programmed OS (CLO 1)

    • What is a process?

    • What are the various components of a process?

    • What are the states a process can be in?

  2. Describe the Unix process API (CLO 1, CLO 2, CLO3, CLO 7)

    • What is a parent process and a child process?

    • How can a process create a child process?

    • What are the different ways in which a process can terminate?

    • How can a parent process manage a child process?

    • What is the API to run a new program?

  3. Write programs using Unix process API (CLO 1, CLO 2, CLO 3, CLO 7)

    • How to use fork() system call to create a new process?

    • How to use an exec() function to run a new program?

  4. Explain the environment of a process and how it can be manipulated (CLO 2, CLO 3, CLO 7)

    • What are environment variables?

    • How can the environment variables be accessed and changed in a Bash shell?

    • How can a program access environment variables?

    • How can a program modify environment variables?

    • What is the relationship between the environment of a parent and a child process?

  5. Use common shell commands related to processes (CLO3)

    • What information can be obtained via the ps command?

    • What is job control?

    • What are foreground and background jobs?

  6. Explain the concept of signals and their uses (CLO 1, CLO2, CLO3)

    • What is a signal?

    • What are the different important signal types?

    • What is the use of different signals?

  7. Write programs using the Unix API for signal handling (CLO 1, CLO 2, CLO3, CLO 7)

    • What are signal sets and how are they used in writing signal handlers?

    • How do we register custom signal handlers?

    • What are reentrant functions and why these should be used in signal handlers?

  8. Explain important concepts in Unix I/O related to file descriptor inheritance and I/O redirection (CLO 2, CLO 5, CLO 7)

    • How and why are file descriptors shared across calls to fork to spawn a child process?

    • How can we stop this sharing through use of dup2 function?

    • What is input redirection?

    • What is output redirection?

    • How can we redirect standard input and standard output?