Download presentation
Presentation is loading. Please wait.
1
ICS 143 - Principles of Operating Systems
Discussion 3 - HW1 review & CPU Scheduling Joe Nash
2
Outline Homework 1 Solutions - will be posted
Lecture 6 - CPU Scheduling Review
3
General Strategies Ctrl-f lecture notes Google question Piazza
4
Don’t do this
5
Homework 1 Q1 Polling/Interrupt definition - Lecture 1 page 66
How many machine instructions can be executed in the time it takes a character to be typed? Arithmetic Interrupts are Asynchronous Traps are software generated interrupts. Lecture 1 page 89
6
Homework 1 Q2 Multiprogramming vs timesharing - Definition Lecture 1 page 67/68 Distributed computing systems Resources distributed over multiple machines Cloud computation, distributed databases, sensor nets
7
Homework 1 Q2 continued C. Discussion 1 page 20
Hard real-time = deadline missed -> failure Soft real-time = deadline missed -> performance lost Non-Real time = deadline missed -> nothing lost Spotify = soft Android UI = soft Cruise control = hard HF trading = hard
8
Homework 1 Q3 For each of the brief description about the following system calls used in Unix, write the name of the system call and its parameters. (Hint: Use the man pages.) Read from a file descriptor --- ssize_t read(int fd, void *buf, size_t count); Wait for process termination --- pid_t wait(int *status); Create a child process (fork) --- pid_t fork(void); Suppose you want to write a program that opens the file passed to it on the command line (argv[1]) and writes another file back out (with the same contents). List 3 system calls that will be used in this program. Any three of the following would be fine: open, read, write, close For each of the following operations, indicate whether they should be privileged or not by checking ☒ the appropriate boxes. Yes No Searching a string for a particular sequence X Generate an interrupt Process hardware interrupt Check list of currently running processes Access network card buffer
9
Homework 1 Q4 Lecture ¾ page 14-15 Lecture ¾ page 7 PCB Yes No
CPU registers X Number of processes Program counter Process id File permissions
10
Homework 1 Q5 Why is that threads are faster to create than processes?
Create process -> allocate memory for the process and create a process control block. Create thread -> create a much smaller thread control block. Suggests one application that benefit from the use of threads Multiple tasks at once Web crawler, FTP, matrix multiplication Distinguish between user-level threads and kernel-level threads in terms of cost of switching. Which of these is more expensive to switch? Switching between user-level threads is cheaper because there is no context switch. Indicate which of these resources are shared among the threads Shared Private Memory (Heap) X Program counter Execution stack Global variables
11
Interprocess Communication
Message passing Send/Receive Shared memory Producer/Consumer Buffer
12
CPU Scheduling First Come First Serve Round Robin
Shortest Job First (SJF) preemptive & non-preemptive When do they perform well? Run them from inputs
13
When do the scheduler algos perform badly?
First Come First Serve Badly - long jobs first Round Robin Badly - many jobs same length Shortest Job First (SJF) Badly - many short jobs, runtime unpredictable Not exhaustive
14
Running the Schedulers
Given Create
15
Finished Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.