Q.1
1)
Answer: b.
2)
Answer: d
3)
Answer: b
4)
Answer: a
5)
Answer: b
6)
Answer: c
7)
Answer: d
8)
Answer:A
9)
Answer : b
10)
Answer: b
Q2/sol//
B/sol//
message passing -Mechanism to allow unrelated processes to communicate by exchanging data.
signal -Message sent by software to indicate that an event or error has occurred. Signals cannot pass data to their recip-ients.
Q3/
A
B/
If all of the threads read, but do not modify, the shared information, then the threads may access the
information concurrently without mutual exclusion.
Q4/
1
Firmware is an appropriate term for describing microcode that is part of a hardware device because it is a type of software that is permanently or semi-permanently installed on a piece of hardware. It controls the basic functions of the device and is responsible for interacting with the device's hardware components. It is similar to the BIOS on a computer, which is responsible for initializing the hardware during the boot process. The firmware is considered as a bridge between the software and hardware, it connects the two and makes them work together.
2-
a)Yes. The OS can look at a blocked process, figure out why it got blocked and analyze weather it will ever have access to the resources it needs to unblock itself. (At least 0(n^2) of time consumption) Another solution would be to record the list of blocked processes at every OS cycle and distinguish between ‘computer time’ processes and ‘human time’ processes. If a ‘computer time’ process has remained blocked for more than 1 second or a ‘human time’ process has remained blocked for more than 1 minute, assume that it is in a deadlock state and deal with it
b)The OS could force the release of all resources before a process can enter a ‘blocked’ state
3-
Kernel-level threads and user-level threads are both types of threads that can be used in operating systems, but they differ in how they are implemented and how they are managed by the operating system.
In kernel-level threads, the operating system is responsible for managing the threads and scheduling them for execution. The operating system has direct control over the threads and can perform context switching between them. This allows the operating system to take into account various factors, such as priority, when determining which thread to execute next. Kernel-level threads are also able to take advantage of multiple processors or cores, allowing for true concurrent execution.
On the other hand, user-level threads are managed by a library or runtime system and are scheduled by the user-level thread library rather than the operating system. The operating system is not aware of the user-level threads, and the user-level thread library is responsible for mapping the threads to available kernel-level threads. Because the operating system is not aware of the user-level threads, it can't take into account priority or other factors when scheduling them. User-level threads are also not able to take advantage of multiple processors or cores.
4-
- Thread T1 acquires the lock on resource "a" first, and then thread T2 acquires the lock on resource "b". Both threads are then able to proceed and release their respective locks in the order shown.
- Thread T2 acquires the lock on resource "b" first, and then thread T1 acquires the lock on resource "a". Both threads are then able to proceed and release their respective locks in the order shown.
- Thread T1 and T2 may both be blocked waiting for the other to release the lock they are trying to acquire. This could lead to a deadlock, where both threads are unable to proceed.
- In some cases, if the locks are implemented with a priority system, one thread may be able to proceed and acquire the lock first, and the other thread has to wait for the first thread to release the lock.
- Thread T1 and T2 may also have different scheduling priorities, which would affect the order in which the threads are able to acquire the locks.