Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 8.2, Problem 8.1PP
Program Plan Intro
Given:
Process | Start time | End Time |
A | 0 | 2 |
B | 1 | 4 |
C | 3 | 5 |
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
26. A system has four processes and five allocatable resources. The current allocation and
maximum needs are as follows:
Available
00 x 1 1
Allocated
Махітит
Process A
10 211
11213
Process B
20110
22210
Process C
Process D
11010
21310
1111 0
11221
What is the smallest value of x for which this is a safe state?
3. Job Scheduling: Consider the problem of scheduling n jobs of known durations
t1, t2, ..., tn, for execution by a single processor. The jobs can be executed in any order, one
job at a time. You want to find a schedule that minimizes the total time spent by all the jobs
in the system. (The time spent by one job in the system is the sum of the time spent by this
job in waiting plus the time spent on its execution.)
Design a greedy algorithm for this problem. Does the greedy algorithm always yield an
optimal solution?
Assignment requires that you should create a virtual machine in AWS (Amazon Web Services) to develop your programs to examine the performance of different pthread contention scope. Try to adopt two different pthread contention scope, process-contention scope, and system-contention scope, execute and compute the average turnaround time.
Problem Statement
According to the code attached in the document, rewrite the function runner that
l The value of MAX is the last 8 number of your student ID
l Display the turnaround time of each pthread of each scheduling algorithm
l Please discuss the results of these scheduling algorithms.
Code MUST BE WRITTEN IN C/C++
#include <pthread.h>
#include <stdio.h>
#include <sys/time.h>
#define NUM_THREADS 5
struct timeval tp_s, tp_e;
struct timezone tzp_s, tzp_e;
void *runner(void *param)
{
int i=0,j=0;
long x;
pthread_t tid= pthread_self();
struct timeval tp_s1, tp_e1;
struct timezone tzp_s1, tzp_e1;
printf(" %d…
Chapter 8 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 8.2 - Prob. 8.1PPCh. 8.4 - Prob. 8.2PPCh. 8.4 - Prob. 8.3PPCh. 8.4 - Prob. 8.4PPCh. 8.4 - Practice Problem 8.5 (solution page 797) Write a...Ch. 8.4 - Practice Problem 8.6 (solution page 797) Write a...Ch. 8.5 - Practice Problem 8.7 (solution page 798) Write a...Ch. 8.5 - Prob. 8.8PPCh. 8 - Prob. 8.9HWCh. 8 - In this chapter, we have introduced some functions...
Ch. 8 - How many hello output lines does this program...Ch. 8 - How many "hello' output lines does this program...Ch. 8 - Prob. 8.13HWCh. 8 - How many hello output lines does this program...Ch. 8 - How many "hello lines does this program print?Ch. 8 - Prob. 8.16HWCh. 8 - Prob. 8.17HWCh. 8 - Consider the following program: Determine which of...Ch. 8 - How many lines of output does the following...Ch. 8 - Use execve to write a program called my1s whose...Ch. 8 - What are the possible output sequences from the...Ch. 8 - Write your own version of the Unix system function...Ch. 8 - One of your colleagues is thinking of using...Ch. 8 - Modify the program in Figure 8.18 so that the...Ch. 8 - Write a version of the fgets function, called...
Knowledge Booster
Similar questions
- Please refer to this textbook: “A. Silberschatz, P. B. Galvin and G. Gagne, “Operating System Principles,”7th Edition, John Wiley & Sons Inc., 2006.” And answer the following questions: Question:The Ricart& Argwala mutual exclusion algorithm: (a) Does not depend on time stamps in messages while Lamport's does. (b) Cannot handle the case where two or more processes request the same resource at the same time. (c) Does not require a process to send messages to the entire group while Lamport's does. (d) Requires fewer messages than Lamport's algorithm.arrow_forwardThe CPU clock is 1 GHz. One OP requires 5 clock cycles (for example arithmetic instruction and conditional). Each memory access (read or write) requires 100 clock cycles and the problem size is 1 million or n = 1,000,000. There is no memory access cost of loop index variable: don't count any arithmetic instructions for initializing or incrementing the loop index value. Assume the loop index variable is free of charge. There is an arithmetic operation involved in updating the accumulator variable. Algorithm Sum = 0 For i in range (0, n); Sum += i; Print (“sum =, sum) How many memory accesses and clocks are required by this algorithm?arrow_forwardThe CPU clock is 1 GHz. One OP requires 5 clock cycles (for example arithmetic instruction and conditional). Each memory access (read or write) requires 100 clock cycles and the problem size is 1 million or n = 1,000,000.There is no memory access cost of loop index variable: don't count any arithmetic instructions for initializing or incrementing the loop index value. Assume the loop index variable is free of charge. There is an arithmetic operation involved in updating the accumulator variable. AlgorithmSum = 0A = list (range(0,N)) //vectorFor i in range (0, n);Sum += A[i];Print (“sum =, sum) In this algorithm how many memory accesses and clocks are required?arrow_forward
- Problem 4 There are two approaches for scheduling tasks on multiprocessor platform: the partitioned approach and the global approach. The table below shows Ci (WCET) and Ti (period) for six periodic tasks to be scheduled on m = 3 processors. The relative deadline of each periodic task is equal to its period. T T1 10 T2 10 25 T3 12 30 T4 10 T5 8. 20 T6 7 100 The task set is schedulable using rate-monotonic partitioned scheduling algorithm. Show how the task set is partitioned on m = 3 processors so that all the deadlines are met?arrow_forward73. Deadlock prevention is a set of methods : a. to ensure that at least one of the necessary conditions cannot hold b. to ensure that all of the necessary conditions do not hold c. to decide if the requested resources for a process have to be given or not d. to recover from a deadlockarrow_forward1. Consider a machine running a program with four classes of instructions: A/B/C/D. The program requires 360 seconds, with the number of seconds executing each class as shown in the table below: Instruction Class A B C Time (sec) 100 80 120 60 1.1. By how much is the total execution time changed if the time for class D is reduced by 20% and the time for class C is increased by 10% (assuming no other changes)? 1.2. If we want to reduce the total execution time by 20% by optimizing class A only, what is the target execution time of class A instructions in order to achieve the reduction (assuming all other instructions are not changed)? 1.3. Can the total time be reduced by 25% if we only optimize class B? Use calculation to justify your answer.arrow_forward
- j f₁(j) f₂(j) 2. for the following instance of the Assembly-Line Scheduling problem, complete the following table constructed by the Dynamic Programming (DP) algorithm. The station time and the transfer times are indicated in the diagram below. Station 2 Station S11 3 4 1 2 2 S21 $12 S22 2 S13 3 2 2 3 S23 $14 4 4 S24 3 $15 2 5 S25 6 $16 3 S26 3 2arrow_forwarda. Three processes share four resource units that can be reserved and released only one at a time. Each process needs a maximum of two units. Show that a deadlock cannot occur. b. N processes share M resource units that can be reserved and released only one at a time. The maximum need of each process does not exceed M, and the sum of all maximum needs is less than M + N. Show that a deadlock cannot occur.arrow_forward(b) Use the Rate Monotonic Scheduling (RMS) scheduling algorithm for the three task below: Task Сарасity Period T1 1 5 T2 3 5 T3 6. 20 (i) What is the Least Common Multiple (LCM) to schedule? (ii) Check the schedulability of these tasks using RMS and confirm whether or not you can determine the schedulability. (iii) What are the dynamic priorities for these three tasks? (iv) Illustrate the execution of the tasks based on RMS in a diagram.arrow_forward
- We are dealing with 6 processes p1;p2; : : : ;p6:(a) Processes p1;p2 in p3 arrive at time 2 ms, respectively. Each of those processesneeds 5 ms of CPU time.(b) Process p4 arrives at time 10 ms and needs 3 ms of CPU time.(c) Processes p5 in p6 arrive at time 19 ms. Process p5 needs 7 ms, while process p6needs 4 ms of CPU time.Scheduling is preemptive, where there process switch takes 1 ms. For the Round-Robinalgorithms with quantum 2 ms illustrate the execution of those processes on a timeline.Then determine the average turnaround time.arrow_forwardProblem 03 : 1)There are 5 different processes executing in the system. The process name , burst time and arrival time are given in the below table. Draw Gnatt chart and calculate the average waiting Time using pre-emptive scheduling of SJRTF. Process Name Burst Time ( ms) Arrival Time ( ms ) P11 4 P12 5 1 P13 10 P14 3 3 P15 8 4 2) Write a python program to read n process with burst times. Calculate the average waiting time for all 'n' process using FCFS scheduling algorithm. Assume n =4 Process Burst Time ( ms) P11 4 P12 5 P13 10 P14 3arrow_forward1. Write a LINUX C code for Banker’s Algorithm to deadlock avoidance.Note: Consider a system with five processes (P0–P4) and three resources (A, B, C). There are 9 instances of resource type A, 4 instances of resource type B, and 6 instances of resource type Carrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr