Docsity

Operating Systems Centric Views - Operating Systems - Lecture Notes, Study notes of Operating Systems

Partial preview of the text

Download Operating Systems Centric Views - Operating Systems - Lecture Notes and more Study notes Operating Systems in PDF only on Docsity!

○ Intermediary between hardware and users. ○ Ensures correct hardware function. Provides high-level programming abstractions to users.

○ Enables resource sharing. Operating systems overview General overview Thursday, September 16, 2004 12:35 PM Docsity.com

Hardware and OS-centric views Hardware OS Interrupts Signals Contexts Processes Interrupt: physical signal that attention is required, normally by changing the voltage on a CPU pin. Context: that combination of memory map, and execution data, that allows a process to run. Signal: process-level abstraction that can interrupt a process and inform it of a state change. Process: autonomous unit of computation. Hardware and OS-centric views Thursday, September 16, 2004 12:35 PM Docsity.com

Refining our view Tuesday, September 04, 2012 3:19 PM Docsity.com

Manage state of processes, hardware, and devices. Protect self, hardware, and devices from errant (or malicious) processes. Enable resource sharing. Jobs of an operating system Jobs of an operating system Tuesday, September 04, 2012 3:22 PM Docsity.com

Each I/O device has a "state machine" that describes its states and functions.

Purpose of a driver: maintain state, insure that one can change from existing state to any desired state.

State (protocol) botch: process thinks device is in one state, while it is in another.

Result: device operation does not work properly.

States and state botches States and state botches Thursday, September 16, 2004 12:55 PM Docsity.com

States of a network card States of a network card Thursday, September 16, 2004 12:55 PM Docsity.com

If send request to device occurs when listening, it works.

If send request to device occurs when it is receiving, it fails.

If two parts of a program maintain different ideas of state, we have a state coherence problem.

Caveat: state botches Caveat: state botches Thursday, September 16, 2004 12:55 PM Docsity.com

Buggy process should not crash the OS. Intentionally malicious processes should not be able to take over. Main mechanisms: memory protection, contexts. Another job of the OS: protect self, devices, other processes from errant or malicious processes Protection Tuesday, September 04, 2012 3:26 PM Docsity.com

Text: contains program, read-only. BSS: contains global variables, read-write. Stack: contains block variables, read-write. Heap: contains dynamically allocated storage, read-write. Segments in a typical process: Segments in a typical program Tuesday, September 04, 2012 3:31 PM Docsity.com

Processes run in their own private address spaces. The only way to get to the operating system is to call a system call. How the OS protects itself Switches from "user mode" to "kernel mode". Disables memory protection. Calls the OS to do something. Enables memory protection. Switches from "kernel mode" back to "user mode". Calling a system call "safely" exposes the OS: In other words, a process can't even see OS code, much less run it. How the OS protects itself Tuesday, September 04, 2012 3:28 PM Docsity.com

Multiple processes can run at once, consuming part of memory, computation time, and devices. Enabling resource sharing When a process runs or dies. When a process asks for memory. The OS gives out memory, and takes it away: Resource sharing Tuesday, September 04, 2012 3:34 PM Docsity.com

Devices are slow, CPU instructions are fast. Waiting for devices could be spent doing useful work. Multiprogramming (or multitasking) Multiprogramming Thursday, September 16, 2004 1:19 PM Docsity.com

 Values of all CPU registers  Image of all memory Context: that information that the process needs to run

 Switch to privileged mode. Save all registers for process #1 (in process record)

If needed, save process memory for process #

 Restore all registers for process #2.  If needed, restore memory for process #2.  Back to unprivileged mode.  Jump to location in other process and run. Context switch: changing from one context to another.

Process concepts Process concepts Thursday, September 16, 2004 1:19 PM Docsity.com

The operating system balances overhead against interactivity. Context switching Thursday, September 16, 2004 1:19 PM Docsity.com