Operating Systems
• Chapter 3:
1- Explain the concept of a process in a computer system and the different parts
that make up a process.
➢ It refers to a program that is currently being executed by the CPU and act as
an instance of a program that is loaded into the memory.
➢ The process is composed of several components, including:
1- Text Section → contains the actual program code.
2- Data Section → contains the global and static variables of the process.
3- Heap → stores variables and data structures that are not known at
compile time.
4- Stack → keeps track of function calls, and local variables.
5- Process Control Block (PCB) → contains information about the process.
2- What’s the Process Control Block (PCB) and mention its purpose?
➢ It’s the identification block of the process.
➢ Its purpose is to be the process’s ID to store its information as its state,
priority, and memory requirements.
3- How many states can the process take and explain each of them?
➢ They are 5 states as the following:
1- New → the process is created.
2- Running → instructions are being executed.
3- Waiting → the process is waiting for an event to occur.
4- Ready → the process is waiting to be assigned by the processor.
5- Terminated → the process has finished execution.
4- What’s the context switch and what does it do?
➢ It’s the process of saving and restoring the state of a running process or
thread in order to switch to another process or task.
5- Describe actions taken by kernel to context-switch between processes.
➢ First, the kernel saves the current state of the process including its values in
all CPU registers and selects the next process to run from the set of
processes.
➢ It restores the context of the next process including restoring registers and
program counter. Then, it updates the page tables to reflect the changes in
the virtual memory.
6- What are the resource sharing and execution options between parent and
child processes?
➢ The resource sharing options are:
1- Parent and children share all resources.
2- Children share subset of parent’s resources.
3- Parent and child share no resources.
➢ The execution options are:
1- Parent and children execute concurrently.
2- Parent waits until children terminate.
7- What happens to a child process when its parent process terminates, and
how is this situation handled by the operating system?
➢ If the parent process terminates, the child process may become an orphan
process and be inherited by the init process.
➢ If the child process terminates, the parent process may receive a signal
indicating the child's exit status.
8- What are the reasons of cooperating processes?
➢ Information sharing → in order to achieve a common goal.
➢ Computation speedup → when the task is too large or too complex to
handle by one process.
➢ Modularity → dividing complex tasks into smaller sub-tasks.
➢ Convenience → in dealing with different parts of specific task.
9- What’s the meaning of message passing and mention its purpose?
➢ It’s a communication mechanism where processes can communicate with
each other by sending and receiving messages.
➢ Its purpose is to allow processes to exchange data and coordinate their
activities.
10- What are the types of message passing and explain the difference between
them?
➢ Message passing may be either blocking or non-blocking.
➢ The main difference between them is how they handle the communication
between processes:
1- Blocking (Synchronous) → the sender or receiver is blocked until the
message is sent or received.
2- Non-blocking (Asynchronous) → the sender sends the message and
continues executing without waiting for the receiver to acknowledge
receipt of the message. (This improves the overall efficiency of the system)
11- What’s meant by the queue of messages and mention the possible ways to
implement it?
➢ It's queue that holds messages waiting to be sent between two processes
or nodes in a computer network and can be implemented by:
1- Zero-capacity queue → has no queue or buffer to store messages.
2- Bounded-capacity queue → has a finite capacity to store messages.
3- Unbounded-capacity queue → store an infinite number of messages.
12- What’s the socket and what does it do?
➢ A socket is a combination of an IP address and a port number that identifies
a unique endpoint for communication.
➢ It enables communication between applications running on different
devices over a network.
13- What’s the Remote Procedure Calls (RPC) and mention its main idea?
➢ It’s a protocol that enables the local computer (client) to call a procedure or
function on a remote server as if it were a local function call.