In: Computer Science
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.
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.