Operating System Processes

Operating System Processes

Operating System User-level Applications Operating System Hardware Resources Sean Barker 2 Processes Memory Memory Memory Stack Stack Stack Heap Heap Heap Data Data … Data Code Code Code CPU CPU CPU Registers Registers Registers Sean Barker 3 Control Flow Abstraction Process A Process B Process C Time Sean Barker 4 Control Flow Time-Sharing Process A Process B Process C Time Sean Barker 5 Context Switching Process A Process B user code kernel code context switch Time user code kernel code context switch user code Sean Barker 6 Physical Control Flow Physical control flow <startup> inst1 inst Time 2 inst3 … instn <shutdown> Sean Barker 7 11/12/15 Exceptions:'hardware/support/for/OS/ Interrupt'Vector stored/in/memory Exceptions special/register/holds/base/address transfer' control' to'OS'in'response' to'event What'code'should'the'OS'run'to'handle'the'event? code/for// Unique'ID'per'type'of'event exception/handler/ 0 Exception Ta bl e code/for/ ID'='index'into'exception'table' User-Process OS exception/handler/ 1 0 (a.k.a./interrupt/vector) 1 code/for exception 2 event' ... exception/handler/ 2 Handler'i is'called'each'time' exception'processing n&1 exception'i occurs by/exception'handler ... return'or'abort code/for/ exception/handler/ n<1 Exception/ numbers a/ jump/table/ for/exceptions… 9 10 Sean Barker 8 Open'a'file (trap/system/ call) Segmentation'Fault Exception Table User/process/calls:/open(filename, options) int a[1000]; open executes/system/call/instruction/int void bad () { Write/to/invalid/memory/location. Excep&on a[5000] = 13; 0804d070 <__li b c _o p e n>: } . numbers 804d082: cd 80 int $0x80 80483b7: c7 05 60 e3 04 08 0d movl $0xd,0x804e360 804d084: 5b Code for pop %eb x . excep&on handler 0 User-Process OS Excep&on Code for Table User-Process excep&on handler 1 OS exception:'page'fault 0 movl 1 detect'invalid'address int exceptionCode for 2 pop excep&on handler 2 signal'process ... open-file returns n-1 ... aborts/process/with/SIGSEGV/ signal Code for excep&on handler n-1 12 13 Sean Barker 9 3 11/12/15 Exceptions:'hardware/support/for/OS/ Interrupt'Vector stored/in/memory Exceptions special/register/holds/base/address transfer' control' to'OS'in'response' to'event What'code'should'the'OS'run'to'handle'the'event? code/for// Unique'ID'per'type'of'event exception/handler/ 0 Exception Ta bl e code/for/ ID'='index'into'exception'table' User-Process OS exception/handler/ 1 0 (a.k.a./interrupt/vector) 1 code/for exception 2 event' ... exception/handler/ 2 Handler'i is'called'each'time' exception'processing n&1 exception'i occurs by/exception'handler ... return'or'abort code/for/ exception/handler/ n<1 Exception/ numbers a/ jump/table/ for/exceptions… 9 10 Sean Barker 10 Open'a'file (trap/system/ call) Segmentation'Fault Example: Segmentation Fault User/process/calls:/open(filename, options) int a[1000]; open executes/system/call/instruction/int void bad () { Write/to/invalid/memory/location. a[5000] = 13; int0804d070 a[1000]; <__li b c _o p e n>: } . main () 804d082: cd 80 int $0x80 80483b7: c7 05 60 e3 04 08 0d movl $0xd,0x804e360 {804d084: 5b pop %eb x . a[5000]. = 13; } User-Process OS 80483b7: User-Process c7 05 60 e3 04 08 0dOS movl $0xd,0x804e360 movl exception:'page'fault detect'invalid'address User code int exceptionKernel code pop signal'process open-file Excep&on: page fault returns movl aborts/process/with/SIGSEGV/ signal Detect invalid address Signal process 12 13 Sean Barker 11 3.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us