Operating Systems 2 - overview
description
Transcript of Operating Systems 2 - overview
![Page 1: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/1.jpg)
1
OPERATING SYSTEMS 2 - OVERVIEWPIETER HARTEL
![Page 2: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/2.jpg)
2
Operating System
Resource manager
Hardware resources
Resources provided by the OS itself (which?)
Objectives
Convenience (why?)
Efficiency (why?)
Evolvability (why?)
Abstraction is the key to managing the complexity
![Page 3: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/3.jpg)
3
History
Batch
Time sharing
Real-time
Multi-processor
Distributed systems
Multi-core (why?)
Electrologica X8 console, 1965
![Page 4: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/4.jpg)
4
Concepts and abstractions
Concept
Processes & Threads
Memory management
Protection and security
Scheduling and resource management
Abstraction of
Processor
Physical memory & disks
Dedicated computer
Dedicated computer
![Page 5: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/5.jpg)
5
Abstraction layers
![Page 6: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/6.jpg)
6
Linux example of the Unix API
Output?
gcc Echo.c
./a.out Hello world
strace ./a.out Hello World
#include <stdio.h>
int main(int argc, char *argv[]) { int i; for(i=0; I < argc; i++) { printf("%s ", argv[i]); } printf("(%d)\n", argc); return 0;}
![Page 7: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/7.jpg)
7
Process abstraction
![Page 8: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/8.jpg)
8
Resource sharing (why?)
Deadlock (why?)
Prevention
Detection
Recovery
Avoidance
![Page 9: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/9.jpg)
9
Process management
Scheduling
Timer
Threads (why?)
Which process is running?
![Page 10: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/10.jpg)
10
extern char etext, edata, end;int a = 0xaaaa, b;int main(int argc, char * argv[]) { int c = 0xcccc; int *d_ptr = (int*) malloc(sizeof(int)); int *e_ptr = (int*) alloca(sizeof(int)); b = 0xbbbb; *d_ptr = 0xdddd; *e_ptr = 0xeeee; printf("%p:a=%0x\n", &a, a); …}
Address space management
Output?
gcc AddressSpace.c
./a.out
text
main
etext
data
a
edata
bss
b
end
heap
d
brk
stack
e
argc
c
low
high
stac
khe
ap
![Page 11: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/11.jpg)
11
Memory management
Paging (why?)
MMU!
Swapping (why?)
![Page 12: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/12.jpg)
12
Protection and Security
Processes vs the OS (how?)
Processes vs other Processes (how?)
Privileged processes (why?)
Access control matrix
![Page 13: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/13.jpg)
13
#include <stdio.h>#include <unistd.h>
#define N 41
int main(int argc, char * argv[]) { if(argc >= 3) { FILE *from = fopen(argv[1], "r"); FILE *to = fopen(argv[2], "w"); char buf[N]; while (fgets(buf,N,from) != NULL) { fputs(buf,to); fputc('\n',to); } fclose(from); fclose(to); return 0; } else { printf("usage %s from to\n", argv[0]); return 1; }}
I/O management
Output?
gcc Wrap.c
strace ./a.out Wrap.c junk
Find the system calls for:
fgets()
fputs()
![Page 14: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/14.jpg)
14
Virtual Machine management
Examples?
![Page 15: Operating Systems 2 - overview](https://reader035.fdocuments.in/reader035/viewer/2022062409/56814fbf550346895dbd791f/html5/thumbnails/15.jpg)
15
Summary
Operating systems are large, hence abstraction to manage complexity:
Processes and threads
Memory
Files and peripherals
User accounts
Management issues
Fairness
Sharing
Protection