{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ECE344-Lecture4-abstractions

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

Info icon This 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
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right 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
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
Image of page 5

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

View Full Document Right 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
Image of page 6
7 ECE344: Operating Systems
Image of page 7

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern