10 August 2015 Charles Reiss https://cs162.eecs.berkeley.edu/

Slides:



Advertisements
Similar presentations
11/15/2005Comp 120 Fall November Seven Classes to Go! Questions! VM and Making Programs Go.
Advertisements

Introduction to Kernel
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
OS Spring’04 Introduction Operating Systems Spring 2004.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
I/O Systems ◦ Operating Systems ◦ CS550. Note:  Based on Operating Systems Concepts by Silberschatz, Galvin, and Gagne  Strongly recommended to read.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
CS 6560 Operating System Design Lecture 13 Finish File Systems Block I/O Layer.
Introduction to Processes CS Intoduction to Operating Systems.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Chapter 4 Processes. Process: what is it? A program in execution A program in execution usually usually Can also have suspended or waiting processes Can.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Chapter 1 Process and Thread. 1.2 process The address space of a program – Text – Code – Stack – Heap A set of registers – PC – SP Other resources – Files.
NT Kernel CS Spring Overview Interrupts and Exceptions: Trap Handler Interrupt Request Levels and IRT DPC’s, and APC’s System Service Dispatching.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
1/9/ :46 1 Priority Model Real-time class Idle Above Normal Normal Below Normal Lowest Highest 31 Time-critical Dynamic classes.
4P13 Week 12 Talking Points Device Drivers 1.Auto-configuration and initialization routines 2.Routines for servicing I/O requests (the top half)
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
4P13 Week 9 Talking Points
Scheduler activations Landon Cox March 23, What is a process? Informal A program in execution Running code + things it can read/write Process ≠
File System Design David E. Culler CS162 – Operating Systems and Systems Programming Lecture 23 October 22, 2014 Reading: A&D a HW 4 out Proj 2 out.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
WORKING OF SCHEDULER IN OS
Input/Output (I/O) Important OS function – control I/O
Introduction to Kernel
CS 140 Lecture Notes: Virtual Memory
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Processes and threads.
Process concept.
Process Management Process Concept Why only the global variables?
Chapter 1: A Tour of Computer Systems
CS 6560: Operating Systems Design
Lesson Objectives Aims Key Words
Avani R.Vasant V.V.P. Engineering College
CSCS 511 Operating Systems Ch3, 4 (Part B) Further Understanding Threads Dr. Frank Li Skipped sections 3.5 & 3.6 
Scheduler activations
CSE451 I/O Systems and the Full I/O Path Autumn 2002
CS 3305 System Calls Lecture 7.
Semester Review Chris Gill CSE 422S - Operating Systems Organization
Threads and Locks.
Threads & multithreading
CSCI 315 Operating Systems Design
CSCI 511 Operating Systems Ch3, 4 (Part B) Further Understanding Threads Dr. Frank Li Skipped sections 3.5 & 3.6 
Case Study 2: Windows History of windows 2000
CS 143A Quiz 1 Solution.
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
CS 140 Lecture Notes: Virtual Memory
Mid Term review CSC345.
Lecture Topics: 11/1 General Operating System Concepts Processes
Chapter 5: I/O Systems.
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
System Calls System calls are the user API to the OS
CSE 153 Design of Operating Systems Winter 2019
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
CS 140 Lecture Notes: Virtual Memory
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Lecture 12 Input/Output (programmer view)
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

10 August 2015 Charles Reiss https://cs162.eecs.berkeley.edu/ CS162: Operating Systems and Systems Programming Lecture 29: Conclusion 10 August 2015 Charles Reiss https://cs162.eecs.berkeley.edu/

What happens when I press a key to advance a slide?

Reading from the Keyboard (1): Making the System Call Before hand: read(keyboard_fd, buffer, 1); … push SYS_READ ; put system call number on user stack push keyboard_fd push buffer push 1 int $0x30

Reading from the Keyboard (2): Handling the system call Before hand: void syscall_handler(f) { read syscall # from f->esp dispatch read syscall extract remaining arguments lookup file descriptor in process control block actually call device driver: keyboard_read()

Reading from the keyboard (3): Top half of the device driver Before hand, after calling read Somewhere deep within the kernel keyboard_read(...): Disable interrupts (why?) Check buffer for characters See none, block thread (e.g. on semaphore)...

What happens when I press a key to advance a slide? Before hand, after calling read, thread is blocked in device driver top half... Blocking thread calls scheduler Scheduler runs another thread (or the idle thread)

Recall: The Context Switch Itself switch(tCur,tNew) { /* Unload old thread */ TCB[tCur].regs.r7 = CPU.r7; … TCB[tCur].regs.r0 = CPU.r0; TCB[tCur].regs.sp = CPU.sp; /* store old thread's return address from switch() */ TCB[tCur].regs.retpc = CPU.retpc; /* Load and execute new thread */ CPU.r7 = TCB[tNew].regs.r7; CPU.r0 = TCB[tNew].regs.r0; CPU.sp = TCB[tNew].regs.sp; CPU.retpc = TCB[tNew].regs.retpc; return; /* Return to CPU.retpc */ }

What about address spaces switch? switch(tCur,tNew) { /* Unload old thread */ TCB[tCur].regs.r7 = CPU.r7; … TCB[tCur].regs.r0 = CPU.r0; TCB[tCur].regs.sp = CPU.sp; /* store old thread's return address from switch() */ TCB[tCur].regs.retpc = CPU.retpc; /* Load and execute new thread */ CPU.r7 = TCB[tNew].regs.r7; CPU.r0 = TCB[tNew].regs.r0; CPU.sp = TCB[tNew].regs.sp; CPU.page_table_base_register = …; CPU.retpc = TCB[tNew].regs.retpc; return; /* Return to CPU.retpc */ }

The keyboard acts Memory Bus PCI Bus Adapter DRAM USB Bus Adapter SATA Bus Adapter $ CPU Keyboard Controller interrupt controller

Move to ready queue

Move to ready queue

Keyboard driver: the top half (again) Somewhere deep within the kernel (again) keyboard_read(...): Done waiting on semaphore Disable interrupts Check buffer for characters Copy into userspace buffer...

Display Memory Mapping Address Space Layout Display Memory Mapping VIRTUAL addresses

Click a link in the browser Same procedure for getting the mouse click as the keyboard input...

Resolve name to address... https://www.cs.berkeley.edu/ → getaddrinfo( "www.cs.berkeley.edu", "443", …);

Resolving www.cs.berkeley.edu We ask our ISP's nameserver "What's an IP address for www.cs.berkeley.edu?" Our ISP's nameserver asks: Root nameserver: "What's an IP address for …?" Root nameserver says "Try this .edu nameserver, IP = w.x.y.z" Edu nameserver: "What's an IP address for …?" Edu nameserver says "Try this berkeley.edu nameserver, IP = w.x.y.z" …

Resolving www.cs.berkeley.edu We ask our ISP's nameserver "What's an IP address for www.cs.berkeley.edu?" Our ISP's nameserver asks: Root nameserver: "What's an IP address for …?" Root nameserver says "Try this .edu nameserver, IP = w.x.y.z" Edu nameserver: "What's an IP address for …?" Edu nameserver says "Try this berkeley.edu nameserver, IP = w.x.y.z" …

Request: Read from Disk First check cache... If not found...

Request: Finding the inode Directory is file: Example above: Linked list: pointers are offsets in file /home/tom/foo.txt → inode # is 66212871

Misc logistics HW3 Wednesday Project 3 tonight

Final Logistics Closed book, closed notes 3 hour timeslot, aiming for 2 hour exam Similar to midterm/past midterms, slightly longer Review tomorrow – please have questions ready