Question

In: Computer Science

1. Why there needs to be user thread and kernel thread? 2. What are the advantages...

1. Why there needs to be user thread and kernel thread?

2. What are the advantages and disadvantages of writing an operating system in a highlevel language, such as C?

3. What is a critical section problem? Demonstrate that with an example.

4. With an example, show how critical section can led to dead locks.

5. Write two differences between a network OS and a distributed OS.

6. Identify the following environments as hard, firm or soft real time. Give reasons behind your answers.

a. Thermostat in a household.

b. Control system for a nuclear power plant.

c. Fuel economy system in an automobile.

d. Landing system in a jet airliner.

Solutions

Expert Solution

1. Why there needs to be user thread and kernel thread?
Ans:
User Threads are managed by the user whereas opertaing sytem manages kernal level thread . In User mode the code execution cannot directly access the hardware which means that even in the worst case scenario our hardware is safe.Whereas kernel mode has unrestricted access to the underlying hardware, this means any code execution running at this mode has elevated permissions and access to the core system files.Thus this facility is provided to the OS only and in this way it also protects their internal data and hardware from any malicious code.

2-What are the advantages and disadvantages of writing an operating system in a highlevel language, such as C?
Ans:
Advantages:
a - High-level languages are easy to write and debug , thus they are programmer friendly.
b - It provide higher level of abstraction from machine languages.
c - They do not interact directly with the hardware. Rather, they focus more on the complex arithmetic operations, optimal program efficiency and easiness in coding.
d - They are machine independent language.

Disadvantages:
a - It takes additional translation times to translate the source to machine code.
b - High level programs are comparatively slower than low level programs.
c - They are less memory efficient
d - They cannot directly communicate to the hardware.

3. What is a critical section problem? Demonstrate that with an example.
Ans:
A critical section is the segment in the code where shared varialbles can be accessed .Thus, for a critical section it is required to check that only one process can execute at a time.All the other processes will have to wait.
The critical section problem is used to design a set of protocols which can ensure that the Race condition among the processes will never arise.
Image source : internet
Here, the entry and the exit section manages the critical part of the program.

4-With an example, show how critical section can led to dead locks.
Ans:
Lets say we have two resources R1 and R2 that comes under critical section area and only 1 process can be executed at a time.
Now , we have two processes P1 and P2:
P1 is accessing R1 and inside that it wants to access R2.
P2 is accessing R2 and inside that it wants to access R1.
Image source : Internet

Thus both process P1 and P2 we be in forever waiting phase which leads to a deadlock situation.

5 - Write two differences between a network OS and a distributed OS.
Ans:
Network OS:
a - Network OS provides services to its remote client ans communication is file based or shared folder based.
b - Network OS is highly scable and less fault tolerent.

Distributed OS:
a - Distributed OS manages hardware resources and communication is message based or shared memory based.
b - Distributed OS is less scalable and has vey high fault tolerance.



  


  


Related Solutions

Name one advantage of associating user threads with kernel thread? Suggest an advantage and disadvantage of...
Name one advantage of associating user threads with kernel thread? Suggest an advantage and disadvantage of using mailboxes over shared memory for inter-process communication.
Thread scheduling at the process level and at the kernel level. This topic requires more work...
Thread scheduling at the process level and at the kernel level. This topic requires more work on my part and I will give an updated draft. There may be more than one question here. Review the different allocation policies for kernel threads in relation to user threads – one to one, many to one, many to many, hybrid. These are sometimes referred to as an “M:N ratio” where M is the number of user threads and N is the number...
What are the advantages of using personal interviews to determine employee needs? Why should these interviews...
What are the advantages of using personal interviews to determine employee needs? Why should these interviews be conducted without the presence of the employee’s supervisor?
Why is important to have posting guidance such as 1) avoiding duplicate thread titles, 2) creative...
Why is important to have posting guidance such as 1) avoiding duplicate thread titles, 2) creative subject lines, 3) avoiding heavy posting on Monday, 4) minimum word count, and 5) professional dialog through editing of posts? Minimum 100 Words
Why do kernel modules generally perform better than user-space device drivers? Name and define five sections...
Why do kernel modules generally perform better than user-space device drivers? Name and define five sections of the process space.
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor environment? Justify your answer
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor environment? Justify your answer.
What are the advantages and disadvantages of user-defined ordinal types as data types? What are the...
What are the advantages and disadvantages of user-defined ordinal types as data types? What are the advantages and disadvantages to an associative array?
Why does the kernel need to validate pointers passed into a system call? What could go...
Why does the kernel need to validate pointers passed into a system call? What could go wrong if it did not validate user pointers?
1. what are the advantages of investing in a mutual fund 2. what are the roles...
1. what are the advantages of investing in a mutual fund 2. what are the roles of sponsor, trustee and AMC
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT