01 Intro
01 Intro
COL331/COL633
• http://abhilash-jindal.com/teaching/2023-2-col-331/
• Grading criteria, TAs, late policy, audit criteria, quizzes, labs, project, piazza
link
(Non-volatile)
Memory (volatile)
Purpose of an OS
• Resource management
• Provide higher-level services
• Protection and isolation
Purpose of OS: Resource management
• Example: cpu.c
• Give the illusion of more CPUs than there are
• Multiplex the hardware
Operating system
Computer hardware
Calculator analogy: Computing long sum
• 2 0 = (move pointer to 10)
20
• + 1 0 = (move pointer to 30)
10
• + 3 0 = (move pointer to 50)
30
50
• + 5 0 = (move pointer to 30)
30 • + 3 0 = (move pointer to 10)
10 • + 1 0 = (move pointer to 20)
20
• + 2 0 = (move pointer to 10)
10
Sharing the calculator
• Steps to share the calculator:
20 10
• 20 + 10 = 30 + 30 = 60
10 70
• Write 60 in notebook, remember that we were done till
30 20 30, give calculator
50 40
• 10 + 70 = 80
30 20
• Write 80 in notebook, remember that we were done till
10 10 70, give the calculator back
20 50
10 10
Remember whatever is on the screen and give calculator?
• Starvation freedom: When there are multiple bankers, one banker never got the
calculator
Purpose of OS: Resource manager
Di erent approaches to memory management:
Operating system
.. .. ..
Computer hardware
Or
1 2 3 4 5 6 7 8 9 10 11 12 .. .. ..
ff
ff
ff
Memory management
• Segmentation is cheap to implement
• But not exible. What if a process needs more memory that what OS gave?
• Paging is complicated to implement
• Highly exible
.. .. ..
1 2 3 4 5 6 7 8 9 10 11 12 .. .. ..
fl
fl
Purpose of an OS
• Resource management
• Provide higher-level services
• Protection and isolation
Purpose of OS: Provide higher-level services
Example: io.c
Computer hardware 1 2 3 4 5 6 7 8 9 10 11 12 .. .. ..
fi
Why file system?
Why not just multiplex disk blocks like memory?
Computer hardware 1 2 3 4 5 6 7 8 9 10 11 12 .. .. ..
ff
fi
fi
Higher level services provide portability
Computer hardware 1 2 3 4 5 6 7 8 9 10 11 12 .. .. ..
Purpose of an OS
• Resource management
• Provide higher-level services
• Protection and isolation
Purpose of OS: Protection
• S_IRUSR | S_IWUSR: File can only be rw by user
• Disallow inappropriate accesses. Example: users
reading each other’s les
Computer hardware 1 2 3 4 5 6 7 8 9 10 11 12 .. .. ..
fi
Purpose of OS: Protection
• Disallow inappropriate accesses.
Example: processes reading each
other’s memory
Operating system
Computer hardware 1 2 3 4 5 6 7 8 9 10 11 12 .. .. ..
Purpose of OS: Isolation
• Example: mem.c
• Multiple processes access the same pointer
location but the OS isolated them with the
help of hardware
Thread 1 Thread 2
Read counter = 0
Write counter = 1
Read counter = 1
Writer counter = 2
Read counter = 2
Read counter = 2
Writer counter = 3
Writer counter = 3
Why should I learn OS in 2024?
Isn’t it a solved problem?
We have indeed made good progress ..
Please run my job
Computer operators
1960s: Batch jobs
Personal
computers
1980s: Interactive jobs!
2000s: Cloud
VM1 VM2 VM3 • Cloud: I can rent virtual machines so I don’t have
to buy and manage servers.
• Macro examples
Libraries
• Personal computers: batch jobs to interactive jobs
• Smartphones: resource constraints, new sensors Operating systems
Computer hardware
Why should I care about learning OS?
If I don’t want to do systems research