csc374And407_lect3 - CSC 374/407 Computer Systems II...

Info icon This preview shows pages 1–16. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC 374/407: Computer Systems II Lecture 3 Joseph Phillips De Paul University 2016 September 6 Copyright © 2011-2016 Joseph Phillips All rights reserved
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
Reading Bryant & O'Hallaron “ Computer Systems, 3 rd Ed. Chapter 8: Exception Control Flow (8.1 – 8.4) Hoover “ System Programming System Calls 7.1-7.4
Image of page 2
Topics Processes 1 Exceptions Interrupts Trap Fault Abort Process lifecycle System calls Processes 2 fork() getpid() and getppid() exit() and atexit() execl() int argc and char*  argv[] wait() , waitpid() Zombies
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
Today's topic (in time) Running executable files and forking
Image of page 4
Today's topic (in space) Loading or setting up everything:
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
One user's view of a computer Computer spends all of its time doing instructions for my program
Image of page 6
Of course computers run multiple processes More than one user More than one process per user OS also handles hardware events (key press, network traffic, timer) and its own maintenance (disk defragmenting)
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
How computers do it
Image of page 8
What's in a context switch? What's has to be loaded and saved? Registers Page table Signal vector (more about that next week) CPU and memory usage stats List of open files etc. Doing a jmp to your own address or a call to your own function handled by a process without outside help. Exceptions , however needed to: Switch between processes Access system resources
Image of page 9

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

View Full Document Right Arrow Icon
4 types of exceptions Class Cause Synchr onicity Return behavior Interrupt Signal from hardware Async Next instruct Trap Intentional call Sync Next instruct Fault Potentially recoverable error Sync Maybe next instruct Abort Unrecoverable error Sync Never returns
Image of page 10
Interrupts Hardware says “I don't care which ordinary user's process you're running, attend to me now! (or at least soon) A key is pressed by the user A packet comes over the network Computer's timer goes off
Image of page 11

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

View Full Document Right Arrow Icon
Doing an interrupt 1. An interrupt (identified by an integer) fires 2. Save state of running process Common to push registers on stack 3. Go to interrupt table ( aka vector table): array of pointers to code to handle interrupts 4. Get address from array 5. Go to that address 6. Do code 7. Re-load state of running process
Image of page 12
Interrupt table or vector table Array of pointers to functions to handle specific interrupts
Image of page 13

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

View Full Document Right Arrow Icon
“IBM PC” i386 Interrupt Table (1) ROM BIOS by IBM (Microsoft?) circa 1981 Now standardized and written by: American Megatrends Inc Micro Firmware Phoenix Technologies 00h CPU:  Executed after an attempt to divide by  zero or when the quotient does not fit in the  destination 01h CPU:  Executed after every instruction while  the trace flag is set 02h CPU:  NMI, used e.g. by POST for memory errors 03h CPU:  The lowest non-reserved interrupt, it is  used exclusively for debugging, and the INT 03  handler is always implemented by a debugging  program
Image of page 14
“IBM PC” i386 Interrupt Table (2) 04h CPU: Numeric Overflow.  Usually caused by the  INTO instruction when the overflow flag is set.
Image of page 15

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

View Full Document Right Arrow Icon
Image of page 16
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