ECE344-Lecture4-abstractions

ECE344-Lecture4-abstractions - Lecture 4: OS Abstractions...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 4: OS Abstractions David Lie ECE344 University of Toronto
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 ECE344: Operating Systems Overview The fundamental operating system abstractions – Threads – Virtual memory – Bounded buffer Hardware support for operating systems System calls Enforcing protection
Background image of page 2
3 ECE344: Operating Systems OS Abstractions The OS provides an abstraction for each type of hardware resource: – Programs access those resources through these abstractions, thus don’t need to know all details of hardware – Examples: • You store information in files, regardless of disk type • You send packets via sockets, regardless of network type Processor Thread Memory Virtual Memory and Address Spaces Communication Links Sockets and Buffers
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 ECE344: Operating Systems Threads A program contains instructions and data values describing how to perform a computation A thread encapsulates the processor state of an active program – The processor state consists of the processor registers, including the program counter (PC) and stack pointer (SP) The thread abstraction saves just enough state to stop a thread at any point of time and resume it later
Background image of page 4
5 ECE344: Operating Systems Running a Thread OS requests user input to identify program “file” OS loads program’s code and data into memory OS allocates a thread – Allocates stack for thread to make procedure calls – Sets SP to top of stack – Load PC to starting address of program CPU runs thread by fetching/decoding/executing the program’s instructions OS multiplexes multiple threads on the processor by stopping and resuming threads Interrupts handled by stopping and resuming thread
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 ECE344: Operating Systems Virtual Memory and Address Spaces How can the OS ensure that threads to do read or corrupt each other’s memory? OS enforces modularity by providing each thread with virtual memory Each thread accesses its own virtual addresses (e.g., via jmp, load, store, etc.) and hardware translates these addresses to physical memory addresses – Threads have the illusion that they have access to the entire address space of the machine. Thus, they can generate any address and it will not be shared with other thread unless explicitly shared The OS uses virtual memory to ensure that threads cannot access each other’s memory
Background image of page 6
7 ECE344: Operating Systems Sockets and Buffers
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 29

ECE344-Lecture4-abstractions - Lecture 4: OS Abstractions...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online