238p: operating systems lecture 3: pc hardware › ... › lecture03-pc-hardware.pdf ·...
TRANSCRIPT
![Page 1: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/1.jpg)
238P: Operating Systems
Lecture 3: PC Hardware
Anton BurtsevJanuary, 2018
![Page 2: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/2.jpg)
Recap from last time
![Page 3: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/3.jpg)
Xv6 system calls
fork() Create a processexit() Terminate the current processwait() Wait for a child process to exitkill(pid) Terminate process pidgetpid() Return the current process’s pidsleep(n) Sleep for n clock ticksexec(filename, *argv) Load a file and execute itsbrk(n) Grow process’s memory by n bytesopen(filename, flags) Open a file; the flags indicate read/writeread(fd, buf, n) Read n bytes from an open file into bufwrite(fd, buf, n) Write n bytes to an open fileclose(fd) Release open file fddup(fd) Duplicate fdpipe(p) Create a pipe and return fd’s in pchdir(dirname) Change the current directorymkdir(dirname) Create a new directorymknod(name, major, minor) Create a device filefstat(fd) Return info about an open filelink(f1, f2) Create another name (f2) for the file f1unlink(filename) Remove a file
![Page 4: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/4.jpg)
Processes
fork() Create a processexit() Terminate the current processwait() Wait for a child process to exitkill(pid) Terminate process pidgetpid() Return the current process’s pidexec(filename, *argv) Load a file and execute it
![Page 5: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/5.jpg)
Files
open(filename, flags) Open a file; the flags indicate read/writeread(fd, buf, n) Read n bytes from an open file into bufwrite(fd, buf, n) Write n bytes to an open fileclose(fd) Release open file fd
![Page 6: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/6.jpg)
I/O redirection and interprocess communication
close(fd) Release open file fddup(fd) Duplicate fdpipe(p) Create a pipe and return fd’s in p
![Page 7: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/7.jpg)
Memory
sbrk(n) Grow process’s memory by n bytes
![Page 8: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/8.jpg)
Directories and named files
chdir(dirname) Change the current directorymkdir(dirname) Create a new directorymknod(name, major, minor) Create a device filefstat(fd) Return info about an open filelink(f1, f2) Create another name (f2) for the file f1unlink(filename) Remove a file
![Page 9: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/9.jpg)
OS implements this interface
![Page 10: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/10.jpg)
PC Hardware
![Page 11: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/11.jpg)
CPU
● 1 CPU socket● 4 cores● 2 logical (HT) threads each
![Page 12: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/12.jpg)
Memory
![Page 13: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/13.jpg)
Memory abstraction
● x86 assembly example:
mov eax, [ebx] ; Move 4 bytes in memory at the address contained in EBX into EAX
![Page 14: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/14.jpg)
I/O Devices
![Page 15: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/15.jpg)
Multi-socket machines
![Page 16: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/16.jpg)
Dell R830 4-socket server
Dell Poweredge R830 System Server with 2 sockets on the main floor and 2 sockets on the expansion
http://www.dell.com/support/manuals/us/en/19/poweredge-r830/r830_om/supported-configurations-for-the-poweredge-r830-system?guid=guid-01303b2b-f884-4435-b4e2-57bec2ce225a&lang=en-us
![Page 17: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/17.jpg)
CPU execution loop
● CPU repeatedly reads instructions from memory
● Executes them● Example
ADD EDX, EAX, EBX // EDX = EAX + EBX
![Page 18: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/18.jpg)
![Page 19: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/19.jpg)
CPU execution loop
● Fault● Instruction's
preconditions are not met
● Examples● Division by zero● Page not mapped
![Page 20: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/20.jpg)
Memory hierarchy
![Page 21: 238P: Operating Systems Lecture 3: PC Hardware › ... › lecture03-pc-hardware.pdf · 2018-09-27 · 238P: Operating Systems Lecture 3: PC Hardware Anton Burtsev January, 2018](https://reader036.vdocuments.net/reader036/viewer/2022081400/5f11aec98e020e0ff520a7d5/html5/thumbnails/21.jpg)
Questions?