250 likes | 328 Views
Operating Systems. Computer Services. What things can your computer do? Calculator Word processing Web browsing Photoshop Paint program Games. These are all pieces of Software!. Software. Software applications usually have very nice interfaces – Buttons Icons Menus Instructions
E N D
Computer Services What things can your computer do? • Calculator • Word processing • Web browsing • Photoshop • Paint program • Games These are all pieces of Software!
Software Software applications usually have very nice interfaces – • Buttons • Icons • Menus • Instructions • Graphics
Computer Components How does the computer perform these functions? • Memory • Disk drive • Circuit Board • Keyboard • Monitor These are pieces of Hardware!
Hardware Hardware components usually have pretty difficult interfaces. Machine Language Program for MIPS Machine [0x00400000] 0x8fa40000 lw $4, 0($29) ; lw $a0, 0($sp) [0x00400004] 0x27a50004 addiu $5, $29, 4 ; addiu $a1, $sp, 4 # argv [0x00400008] 0x24a60004 addiu $6, $5, 4 ; addiu $a2, $a1, 4 # envp [0x0040000c] 0x00041080 sll $2, $4, 2 ; sll $v0, $a0, 2 [0x00400010] 0x00c23021 addu $6, $6, $2 ; addu $a2, $a2, $v0 [0x00400014] 0x0c000000 jal 0x00400020 [main] ; jal main [0x00400018] 0x3402000a ori $2, $0, 10 ; li $v0 10 [0x0040001c] 0x0000000c syscall
Operating System User Operating System Hardware
Virtual Environments Operating Systems make the computer applications organized • Hallway • Desk • File Cabinet • Book Shelf
Virtual Environments You’ve seen Operating Systems already: • Windows whatever • UNIX • Mac Usually work with WIMPs (Windows, Icons, Menus, Pointers)
Desktops • Windows
Desktops • Mac
Desktops • Linux
Desktops • Unix
Booting up • If the OS is the program that runs the other programs, how does the OS program get loaded and run in the first place? • When you turn on the computer, it runs a hardwired program called bootstrap code that loads the OS.
OS Services • Provides access to software • Gives interface to user • Knows how to load applications into memory • Provides other communication between the user and the application
OS Services • Provides a secure computing environment - Security for a system (logins and passwords) - Security for internal files and functions(You can’t erase my files; A program crash won’t crash the whole computer) - Security from hardware failure (tries to protect you from crashes with backup measures)
OS Services 3. Provides a file system public_html wedding cps1 index.html<HTML>My Homepage images Comp.gif Guestlist Spreadsheet index.html<HTML>My CPS1Homepage Lab 1
OS Services 4. Provides for Multiprogramming (Multitasking) A process is a program in some state of execution. Many can be running at once, while the processor is waiting on one process, it runs a second. Some processes have priority over the others. It may also interrupt a process because of error or just to give another process a chance to run.
More on Multiprogramming OS Print a file Read from Disk Process 2 RegisterValues Disk A Process 3 RegisterValues Disk A Process 1 RegisterValues Printer
More on Multiprogramming • Several programs are competing for processor time, memory, use of devices, etc… • OS is the manager that says who gets what • OS must be programmed to avoid problems…
Dining Philosophers • Dijkstra: 1965 • Setup for thinking about multiple processes sharing resources
Scenario 1: • Everyone must pick up/put down left utensil first and then right utensil • NO grabbing both at same time!!! • Show Deadlock
Scenario 2: • Number around table • Evens: Left, then right (pick up/put down) • Odds: Right, then left (pick up/put down) • NO GRABBING BOTH AT SAME TIME!!! • Deadlock? • Starvation? • Can you make up something better?
Multiprogramming Potential Problems • Starvation – one process never gets the chance to get a resource • Deadlock – every process waiting for something, and none can run • Dirty Data – if more than one process is accessing a piece of data, there can be problems
Data Sharing: Dirty Data x = 4; x = x + 1; print x; Shared integer x x = x + 6;
Conclusion • Operating Systems provide a bridge between user and computer • They give access to computer functionality • They provide security • They provide file systems • They manage multiprocessing and resource allocation