Question
Suppose the hypothetical processor of Figure 1.3 also has two I/O instructions: (15 points) 0011 = Load AC from I/O 0111 = Store AC to
- Suppose the hypothetical processor of Figure 1.3 also has two I/O instructions: (15 points)
0011 = Load AC from I/O
0111 = Store AC to I/O
In these cases, the 12-bit address identifies a particular external device. Show the program execution (using format of Figure 1.4) for the following program:
1. Load AC from device 5.
2. Add contents of memory location 940.
3. Store AC to device 4.
Assume that the next value retrieved from device 5 is 6 and that location 940 contains a value of 3.
- A system adopts a priority-based preemptive scheduling where the initial priority of a process increases by 1 after every 5ms. In a recorded time span, the system has four processes P1, P2, P3, P4 as shown in the following table: (10 points)
Process ID | Initial Priority | Arrival Time in ms | Total CPU time in ms |
P1 | 1 | 0 | 15 |
P2 | 3 | 5 | 7.5 |
P3 | 2 | 10 | 5 |
P4 | 2 | 15 | 10 |
Draw a timing diagram similar to Fig 3.7 and find the turnaround time for each process. Assume that the dispatcher takes 2.5ms for a process switch.
- Write a multithreaded program that calculates various statistical values for a list of numbers. This program will be passed a series of numbers on the command line and will then create three separate worker threads. One thread will determine the average of the numbers, the second will determine the maximum value, and the third will determine the minimum value. For example, suppose your program is passed the integers
- 90 81 78 95 79 72 85
The program will report
The average value is 82
The minimum value is 72
The maximum value is 95
The variables representing the average, minimum, and maximum values will be stored globally. The worker thread will set these values, and the parent thread will output the values once the workers have exited. (30 points)
- How many processes are created in the following program (5 points)
- Explain the following (20 points)
- Difference between short-term and long-term scheduling
- Ordinarily the exec() system call follows the fork(). Explain what would happen if a programmer were to inadvertently place the call to exec() before the call to fork().
- Difference between parallelism and concurrency
- Difference between process and thread
- Thread pool and its use
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started