CSC369H1 Final: FINAL EXAM cheat sheet

381 views2 pages
10 Nov 2015
School
Course

Document Summary

I n t r o d u c t i o n : os#goals#=#1. #convenience#for#user;#2. #efficient#operation#of#computer#system, may#contradict,#tradeoffs#made#(windows#=#convenience,#supercomputer#=#efficiency), os#roles:#virtual)machine# #simplifies#interface#to#hw;#resource)allocator) )shares#resources;# control)program# #control#execution#of#user#program,#prevent#errors, overview#of#computer#system, red#line#separates#user#software#and#os#software#(kernel), storage:#processor#registers#(l1,#l2,#l3#cache),#main#memory#(ram),#aux#memory#(disk), thread/process)life)cycle,#dependent#on#scheduler/physical#cpu, there#are#queues#for#each#state#(ready,#block,#etc. T h r e a d s ) & ) p r o c e s s e s : processes# #a#program#in#execution,#active#entity;#os#abstraction#for#execution,#aka#job,#task, os#manages#processes#by#keeping#track#of#their#state#(process)state)#, only#1#in#the#running#state;#others#in#new,#ready,#blocked,#or#exit#state# Global#variables#heap#allocated#variables#of#process#still#shared#btwn#threads: processor)scheduling) #allocation#of#threads#to#processors#over#time;#goals:, fairness# #each#thread#receives#fair#share#of#cpu;#equal#or#proportional#shares?, avoid#starvation, policy)enforcement# #meet#usage#policies;#ex. #avoid#monopolization,#or#have#biases, balance# #all#parts#of#the#system#should#be#busy, throughout#(batch#systems)# #maximize#jobs#completed#per#hour, turnaround)time)(batch#systems)# #minimize#time#btwn#submission#and#completion, cpu)utilization#(batch#systems)# #keep#the#cpu#busy#all#the#time, response)time#(pcs)# #min#time#btwn#receiving#requests#starting#to#produce#output, proportionality#(pcs)# #simple#tasks#complete#quickly, meet#deadlines#(realmtime#systems)# #work#has#to#be#completed#by#deadline# C o n c u r r e n c y : synchronization# #mechanism#that#restrict#the#possible#interleaving#of#executing, void v(struct semaphore *sem) , spinlock_acquire(&sem->sem_lock), sem->sem_count++, wchan_wakeone(sem->sem_wchan), spinlock_release(&sem->sem_lock), mutex#(binary)#semaphores# #represents#access#to#a#resource#(lock#like);#count = 1, count)semaphores# #represents#a#resource#w/#many#units#available,#or#allow# unsynchronized#concurrent#access# ex. #reading;#count = n# Ex. ##complex#wait#condition:##if x == 0 && (y > 0 || z > 0); ! wait# block#any#writers#till#all#readers#are#done#blocks# Releases#lock,#waits,#remacquires#lock#before#return# cv_wait(struct cv *cv, struct lock *lk)# cv_signal(struct cv *cv, struct lock *lk) #wakes#one#thread# If#no#thread#is#waiting,#cv_signal/cv_broadcast#has#no#effect,#unlike#v(): always#used#together#with#locks, monitors)an#abstract#data#type#w/#restriction#that#1#process#at#a#time#be#active#w/i#monitor, local#data#accessible#via#monitor#procures#(monitor#enforces#mutual#exclusion), condition#variables#can#be#used#to#allow#another#process#to#use#monitor#while#1#waits, operations:#wait#(suspend#invoking#process),#signal#(resumes#1#suspended#process), semantics:#local)data#=#what#monitor#protects;#entry)queue#=#queue#of#waiting#threads)