Module 6: CPU Scheduling - PowerPoint PPT Presentation

About This Presentation
Title:

Module 6: CPU Scheduling

Description:

See topic list Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Problem 7 Write the UNIX ... For each process ... (Shortest Time Remaining First ... – PowerPoint PPT presentation

Number of Views:108
Avg rating:3.0/5.0
Slides: 10
Provided by: Marily555
Category:

less

Transcript and Presenter's Notes

Title: Module 6: CPU Scheduling


1
Operating SystemsLecture 18 Midterm Review
2
Types of Questions to Expect
  • Short answer
  • Define terms
  • Diagrams (e.g. process states)
  • List components/types (e.g. PCB components, types
    of process communication, etc).
  • Etc.
  • Essays
  • Describe ...
  • Compare different types of ...
  • Describe advantages/disadvantages of ...
  • Etc.
  • Programming problems, etc.
  • See topic list

3
Problem 1
Write the UNIX command line to pipe the output of
the "ls -l" command to the "grep" command.
grep should search for "myfile.cc". Redirect
the output of grep to the file, "test.out".
4
Problem 2
Write a C program, readWrite.cc, that takes 2
arguments. The first argument is the name of an
input file. The second argument is the name of
an output file. The program should check that
the correct number of arguments was entered. It
should then read in a single integer from the
input file and output it to the output file.
5
Problem 3
Write a C program in which the parent process
forks two child processes. The second child
should also fork a single child process (the
grandchild of the parent). Each process should
print its name to stdout (first child, second
child, grandchild or parent).
6
Problem 4
Diagram the process tree produced by the
following code. Label each process created with
consecutive pid's starting with 1 (for the parent
process). For each process, indicate the values
of the variables, cpid, cpid2 and cpid3 after all
the forks have been executed. int cpid -1 int
cpid2 -1 int cpid3 -1 cpid fork(
) cpid2 fork( ) if (cpid 0) cipd3
fork( )
7
Problem 5
Write a C program to implement the following
UNIX command line using a pipe ls -l grep
myfile.txt
8
Problem 6
  • Use the SRTF (Shortest Time Remaining First)
    scheduling algorithm to answer the following.
    Suppose 4 processes arrive at the following times
    with the following burst times
  • Process Arrival Time Burst Time
  • P1 0 50
  • P2 20 20
  • P3 25 10
  • P4 40 24
  • a) Draw the Gantt diagram for these processes.
  • b) Compute the following
  • Average Service Time, Throughput, Average
    Turnaround, Average Wait time.

9
Problem 7
Write a UNIX shell script to add together the
first n integers and print the answer to the
monitor. n should be given as an argument to the
script.
Write a Comment
User Comments (0)
About PowerShow.com