📚 Operating Systems

Chapter 3: Processes

Comprehensive Examination

Course Code CS 330
Duration 120 Minutes
Total Marks 75 Marks
Total Questions 50 Questions
Section 1: Process Concept (12 marks)
Q1 [1 mark]
A process is:
  • a) A program stored on disk
  • b) A program in execution
  • c) The same as a thread
  • d) A section of memory
Q2 [1 mark]
Which of the following is NOT a section of a process in memory?
  • a) Text section
  • b) Data section
  • c) Heap
  • d) Cache
Q3 [2 marks]
What is the difference between a program and a process?
Q4 [2 marks]
Describe what is stored in the Stack section and the Heap section of a process.
Q5 [1 mark]
The text section of a process contains:
  • a) Global variables
  • b) Function parameters
  • c) Program code (executable instructions)
  • d) Dynamically allocated memory
Q6 [3 marks]
Explain the difference between an I/O-bound process and a CPU-bound process. Give an example of each.
Q7 [1 mark]
One program can be:
  • a) Several processes (multiple users executing the same program)
  • b) Only one process at a time
  • c) Part of multiple programs
  • d) None of the above
Q8 [1 mark]
A program becomes a process when:
  • a) It is compiled
  • b) An executable file is loaded into memory
  • c) It is saved to disk
  • d) The operating system starts
Section 2: Process State (10 marks)
Q9 [3 marks]
Name and briefly describe the FIVE process states.
Q10 [1 mark]
A process that is currently in the 'Running' state can next go to which states? (From old exam)
  • a) Only terminated state
  • b) Only waiting or ready state
  • c) Terminated, waiting, or ready state
  • d) Only new state
Q11 [1 mark]
When a process is waiting for I/O to complete, it is in which state?
  • a) Ready state
  • b) Waiting state
  • c) Running state
  • d) Terminated state
Q12 [1 mark]
Only ONE process can be running on any processor core at any instant. True or False?
  • a) True
  • b) False
Q13 [2 marks]
What causes a process to move from the running state to the waiting state?
Q14 [2 marks]
What causes a process to move from the waiting state to the ready state?
Section 3: Process Control Block (PCB) (8 marks)
Q15 [3 marks]
What is a Process Control Block (PCB)? List at least FOUR pieces of information stored in a PCB.
Q16 [1 mark]
The PCB is also called:
  • a) Process State Block
  • b) Task Control Block
  • c) Memory Control Block
  • d) Thread Control Block
Q17 [1 mark]
(True/False - From old exam) The program counter, the register values and the stack pointer values are stored in the text section of a process during context switch.
  • a) False
  • b) True
Q18 [3 marks]
Explain what happens during a context switch. Why is context switching considered overhead?
Section 4: Process Scheduling (12 marks)
Q19 [2 marks]
What is the main objective of multiprogramming? (From old exam)
Q20 [1 mark]
The degree of multiprogramming is defined as:
  • a) The speed of the CPU
  • b) The number of CPUs in the system
  • c) The number of processes in memory
  • d) The size of the memory
Q21 [3 marks]
Explain the difference between the ready queue and the wait queue.
Q22 [3 marks]
Describe the difference between short-term scheduler, medium-term scheduler, and long-term scheduler.
Q23 [1 mark]
Which scheduler is also called the CPU scheduler?
  • a) Short-term scheduler
  • b) Long-term scheduler
  • c) Medium-term scheduler
  • d) Job scheduler
Q24 [2 marks]
What is the role of the medium-term scheduler? What process is it involved in?
Section 5: Operations on Processes (15 marks)
Q25 [1 mark]
In UNIX, which system call creates a new process?
  • a) fork()
  • b) exec()
  • c) wait()
  • d) exit()
Q26 [2 marks]
What is the return value of fork() in the parent process and in the child process?
Q27 [2 marks]
What is the purpose of the exec() system call? How does it differ from fork()?
Q28 [2 marks]
Consider the following C program from old exams:
#include <sys/types.h> #include <stdio.h> #include <unistd.h> int value = 5; int main() { pid_t pid; pid = fork(); if (pid == 0) { /* child process */ value += 15; return 0; } else if (pid > 0) { /* parent process */ wait(NULL); printf("PARENT: value = %d", value); return 0; } }
What will be the output at the printf statement?
  • a) PARENT: value = 20
  • b) PARENT: value = 5
  • c) PARENT: value = 15
  • d) PARENT: value = 0
Q29 [2 marks]
Including the initial parent process, how many processes are created by this program?
int main() { fork(); // fork #1 fork(); // fork #2 fork(); // fork #3 return 0; }
  • a) 3 processes
  • b) 4 processes
  • c) 6 processes
  • d) 8 processes
Q30 [2 marks]
Including the initial parent process, how many processes are created?
int main() { int i; for (i = 0; i < 4; i++) fork(); return 0; }
  • a) 4 processes
  • b) 8 processes
  • c) 16 processes
  • d) 32 processes
Q31 [2 marks]
What is a zombie process? What is an orphan process?
Q32 [1 mark]
What is cascading termination?
  • a) When a process terminates normally
  • b) When a parent terminates, all its children and descendants are also terminated
  • c) When multiple processes terminate at the same time
  • d) When a process fails and crashes
Q33 [1 mark]
(True/False - From old exam) A process gets created when an icon of an executable file is double-clicked.
  • a) True
  • b) False
Section 6: Interprocess Communication (IPC) (18 marks)
Q34 [3 marks]
What is the difference between independent processes and cooperating processes? Give reasons why processes might cooperate.
Q35 [3 marks]
Describe the TWO fundamental models of interprocess communication (IPC). What are the advantages and disadvantages of each?
Q36 [1 mark]
In shared memory IPC, who controls the communication?
  • a) The operating system
  • b) The user processes
  • c) The kernel
  • d) The hardware
Q37 [2 marks]
What is the Producer-Consumer problem? Briefly describe it.
Q38 [2 marks]
What is the difference between bounded-buffer and unbounded-buffer in the Producer-Consumer problem?
Q39 [1 mark]
In message passing IPC, processes communicate by:
  • a) Sharing a region of memory
  • b) Sending and receiving messages
  • c) Using global variables
  • d) Modifying each other's stack
Q40 [2 marks]
What is the difference between direct and indirect communication in message passing?
Q41 [2 marks]
Explain the difference between blocking (synchronous) and non-blocking (asynchronous) message passing.
Q42 [1 mark]
In indirect communication, messages are sent to and received from:
  • a) Specific process IDs
  • b) Shared memory segments
  • c) Mailboxes (or ports)
  • d) The operating system kernel
Q43 [1 mark]
Which IPC mechanism is generally faster?
  • a) Shared memory
  • b) Message passing
  • c) Both are equally fast
  • d) It depends on the OS
Section 7: Additional Concepts (Bonus: 10 marks)
Q44 [2 marks]
Assume a single processor multiprogramming system: If process P1 is executing and wants to perform I/O operation, what state transitions occur? What happens with the PCB?
Q45 [2 marks]
Consider the following code (from old exam):
#include <sys/types.h> #include <stdio.h> #include <unistd.h> int main() { pid_t pid, pid1; pid = fork(); if (pid == 0) { pid1 = getpid(); printf("child: pid = %d",pid); /* A */ printf("child: pid1 = %d",pid1); /* B */ } else { pid1 = getpid(); printf("parent: pid = %d",pid); /* C */ printf("parent: pid1 = %d",pid1); /* D */ wait(NULL); } return 0; }
Assume actual pids are: parent=2600, child=2603. What is printed at line C?
  • a) parent: pid = 2600
  • b) parent: pid = 2603
  • c) parent: pid = 0
  • d) parent: pid = 1
Q46 [2 marks]
What are pipes? How are they used for IPC in UNIX systems?
Q47 [2 marks]
What is the Chrome browser's multiprocess architecture? Why does Chrome use multiple processes?
Q48 [1 mark]
Chrome's renderer processes run in a:
  • a) Kernel mode
  • b) Supervisor mode
  • c) System mode
  • d) Sandbox (restricted environment)
Q49 [Bonus 3 marks]
Explain the race condition problem with the Producer-Consumer example where both producer and consumer modify a shared counter variable. Why does this problem occur?
Q50 [Bonus 3 marks]
Compare and contrast processes and threads. When would you use multiple processes vs. multiple threads?

Exam Results