[go: up one dir, main page]

0% found this document useful (0 votes)
11 views9 pages

Solved Questions Module 2

Uploaded by

bedakanz4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

Solved Questions Module 2

Uploaded by

bedakanz4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Solved Questions Module-2

1. With a figure, explain how process is created using fork () system call?

Parent process create children processes, which, in turn create other processes, forming a
tree of processes. Generally, process identified and managed via a process identifier (pid)
fork() system call creates new process
2. What is the use of Process Control Block (PCB) in operating system?
3. Explain process control block.
Each process is represented in the operating system by a Process Control Block (PCB)-also called a
task control block. In brief, the PCB simply serves as the repository for any information that may vary
from process to process. - 1 mark

PCB diagram + field details – 2 Marks


4. How many times ‘Good Luck’ and ‘Do well’ will be printed after executing the following
code. Justify your answer.
void main()
{
fork();
printf(“Good Luck\n”);

fork();
fork();
printf(“Do well\n”);
}
7 child processes and Good Luck printed 2 times and Do well printed 8 times.

2n is used to find count of printed statements.


21 = 2 times printed Good Luck.
23 = 8 times printed Do well.
2n – 1 =7 child processes.
5. How many times will ‘Forked’ get printed by the below code and justify your answer.
int main() {
fork();
fork();

printf("Forked\n");
return 0;}

3 child processes will be created and hence together with parent, it will print Forked 4
times.

6. List and explain the various synchronous and asynchronous methods of message
passing in IPC.

Blocking send. Non blocking send, Blocking receive, Non blocking receive
Message passing may be either blocking or nonblockingalso known as synchronous and
asynchronous.

 Blocking send. The sending process is blocked until the message is received by the
receiving process or by the mailbox.
 Nonblocking send. The sending process sends the message and resumes operation.
 Blocking receive. The receiver blocks until a message is available.
 Nonblocking receive. The receiver retrieves either a valid message or a null.

7. Explain the different buffering mechanisms used in message passing systems?


Whether communication is direct or indirect, messages exchanged by communicating
processes reside in a temporary queue. Basically, such queues can be implemented in three
ways:

 Zero capacity -The queue has a maximum length of zero; thus, the link cannot have
any messages waiting in it. In this case, the sender must block until the recipient
receives the message.
 Bounded capacity. The queue has finite length n; thus, at most n messages can
reside in it. If the queue is not full when a new message is sent, the message is
placed in the queue, and the sender can continue execution without waiting. The
link's capacity is finite. If the link is full, the sender must block until space is available
in the queue.
 Unbounded capacity. The queue's length is potentially infinite; thus, any number of
messages can wait in it. The sender never blocks.
8. Define the parameters for multilevel feedback queue scheduling? How it is better
compared to multilevel queue scheduling?
9. Write the difference between process and thread.

 The primary difference is that threads within the same process run in a shared
memory space, while processes run in separate memory spaces.
 Threads are not independent of one another like processes are, and as a result
threads share with other threads their code section, data section, and OS resources
(like open files and signals).
 But, like a process, a thread has its own program counter (PC), register set, and stack
space.
10. Differentiate between the two common models of interprocess communication.
11. Differentiate Pre-emptive and Non-pre-emptive scheduling giving the application of
cach of them.

12. Why is context switching considered to be an overhead to the system?

You might also like