Operating System Principles ?????? Chapter 3 ?? - PowerPoint PPT Presentation

1 / 45
About This Presentation
Title:

Operating System Principles ?????? Chapter 3 ??

Description:

Title: 1 Author: sju Last modified by: Chris Hsu Created Date: 3/2/2006 8:31:33 AM Document presentation format: Company – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 46
Provided by: sju80
Category:

less

Transcript and Presenter's Notes

Title: Operating System Principles ?????? Chapter 3 ??


1
Operating System Principles??????Chapter 3 ??
  • ??
  • ABRAHAM SILBERSCHATZ
  • Yale University
  • PETER BAER GALVIN
  • Corporate Technologies
  • GREG GAGNE
  • Westminster College
  • ??
  • ??? ??? ???

2
Chapter 3 ????
  • 3.1 ??
  • 3.2 ????
  • 3.3 ?????
  • 3.4 ?????
  • 3.5 lPC?????
  • 3.6 ??/??????

3
Chapter 3 ????
  • ??????????????????????
  • ??????????????
  • ??????????????????,???????
  • ?????????????????????????
  • ???????????,????????????????????,???????????
  • ????????????
  • ??????????????
  • ??????????????

4
3.1 ??
  • ??????????????????CPU?????????????????
    (jobs),????????????(user programs),(?????,task)?
  • ?????????? (?Microsoft Windows)??????????????????
    ??????????email?????????????????????,?????????????
    ??,????????????????,??????????,???????????

5
  • 3.1.1 ??
  • ????????????????????? (????????,text
    section)??????????????????? (Program
    counter)?????????????
  • ????,??????????? (?????????????,???????)?????
    (stack),?????????????(data section)????????
    (heap),?????????????????????,?????????3.1?

6
  • 3.1.1 ??
  • ????????,????? (passive) ???
  • ???????????,??????? (program counter)
    ???????????,?????????
  • ?????????????????,????????????????????
  • ???????????mail?? (??????????)
  • ???????????????? (???????????)
  • ????????????,???????????????

7
  • 3.1.2 ????
  • ?????????????????? (state)????????????,???????????
    ???????
  • ??? (new)?????????
  • ?? (running)???????
  • ??(waiting)?????????(???????????????)?
  • ?? (ready)??????????????
  • ?? (terminated)????????

8
  • 3.1.3 ?????
  • ??????????????????????? (Process control block,
    PCB)??????? (task control block),??3.3??????
    (PCB)?????????????,??
  • ???????new?ready?running?waiting?halted??
  • ?????????????????????

9
  • CPU?????????,??????????????? (accumulator)??????
    (index register)????? (stack pointer)?????????
    (general-purpose register)?,???????? (condition
    code)???????,?????????????????????,?????????????,?
    ??????????????? (??3.4)?
  • CPU????????????????? (priority)?????(scheduling
    queue)?????????????
  • ???????????????????(base register)??????(limit
    register),???(page table)????????????????(segment
    table)?
  • ???????CPU????????????????????????
  • ??/????????????????/????,????????? ???

10
(No Transcript)
11
3.2 ????
  • ?????????????,????????????,????CPU??????????????CP
    U????????????,??????????????????????
  • ????????,??????(process scheduler)?CPU????????????
    ??(?????????)?
  • ?????????,???????????????????????,??????????????CP
    U??,????????

12
3.2.1 ???? ????????,?????????(job
queue)??,?????????????????????????????????????????
????? (ready queue)???????????????????????????????
?????????????????PCB (Process Control
Block),?????)????
13
?????????????????????????????,??????????
(dispatched)?????????CPU??????,????????????? .???
??1/0??,??????1/0???? .?????????????????????? .???
?????CPU(?????????),??????????
14
  • 3.2.2 ???? (scheduler)
  • ??????????????????????????????????????????????????
    ???????????? (scheduler)????
  • ???????,??????????????????????,???????spooling????
    ????????? (?????) ,??????????
  • ?????? (long-term scheduler, ?? ?????? job
    scheduler) ??????????????????????
  • ??????
  • ?????? (short-term scheduler, ?? CPU scheduler)
    ??????????????????,??CPU????
  • ????CPU??????,???100???????

15
  • ????????? ????????? (degree of multiprogramming)
  • ?????????????,???????????????????????????????
  • ?????????????????,???????????
  • I/O ???? (I/O-bound process) ,?I/O?????????????
  • CPU ???? (CPU-bound process) ,????????I/O??????

16
  • ????,?????,?????????????????????????????
    (medium-term scheduler)???????????????????????????
    ???(????CPU??????)??????????????
  • ??,??????????????????????????????????? (swapping)?

17
  • 3.2.3 ????
  • ?????????CPU????????????,???????????????????????,?
    ????????CPU???????? (context),????????,???????,???
    ?????,??????
  • ?? CPU????????????????????,???????????????????????
    ?(context switch)?

18
3.2 ?????
  • ????????????????????????????????,?????????????????
    ??

19
  • 3.3.1 ?????
  • ??????????,???????????????????????????????????
    (Parent process),???????????(children
    process)????????????????????,?????????? (tree of
    processes)?

20
(No Transcript)
21
3.4 ?????
  • ?????????????????????????????
  • ???? ??????????????????????
  • ???? ??????????????????????
  • ????????????,??????,???????
  • ???? ?????????????????(??,????)??
    ?,???????????????????????????
  • ???? ?????????????????,??????????,
    ???????????????????????? ?????????????????,??????
    ????? ??
  • ???????????????????????

22
  • ??????????????????????? (interprocess
    communication, IPC) ,???????
  • ????? (shared memory)
  • ???? (message passing)

23
  • 3.4.1???????
  • ?????????????????????????????
  • ???????????????????,??????????????????????
  • ???????????,????? ???-???????,??????????????????(
    producer)??????,???(consumer)??????????
  • ???-???????????????????,????????????????
  • ????? (unbounded buffer)
  • ????? (bounded buffer) ,?????,???????,?????,??????
    ?

24
  • ?????????????
  • define BUFFER_SIZE 10
  • Typedef struct
  • . . .
  • item
  • item bufferBUFFER_SIZE
  • int in 0
  • int out 0
  • ?? in ???????????,?? out ??????????????
  • in out, ?????,(in1) BUFFER_SIZE ) out
    ,?????
  • Solution is correct, but can only use
    BUFFER_SIZE-1 elements

25
(No Transcript)
26
  • 3.4.2 ??????
  • ????????????????????????????????
  • ???????,IPC????
  • ????????chat?????,??????????????????
  • ????????????
  • send
  • Receive
  • ??????P?Q?????,?????????,??????????????send
    /receive?????
  • ???????
  • ????????
  • ?????????

27
  • 3.4.2.1 ??
  • ???? (direct communication)???,???????????????????
    ????????????????????,send()? receive()?????????
  • send (P, message)??????(message)???P?
  • receive (Q, message)???Q??????(message)?
  • ?????(indirect communication)??,?????(mailbox,????
    ,port)??????????? Send()? receive() ??????????
  • Send (A, message) ??? (message)?????A?
  • Receive (A, message) ???A?????? (message)?

28
  • 3.4.2.2 ???
  • ?????????(blocking)????(nonblocking),?????
    (synchronous)???? (asynchronous)?
  • ???? (blocking send)???????,??????????????
  • ????? (nonblocking send)??????????????
  • ???? (blocking receive)?????,?????????
  • ????? (nonblocking receive)???????????????

29
  • 3.4.2.3 ???
  • ??????????,?????????????????????
  • ???
  • ?????
  • ??????

30
3.5 IPC ?????
  • ???????IPC??
  • POSIX API ??????
  • Mach ?????????
  • Windows XP

31
  • 3.5.1 POSIX ?????
  • ??????shmget () ???? (SHared Meomry GET) ,
    ???????
  • segment_id shmget (IPC_PRIVATE, size, S_IRUSR
    S_IWUSR)
  • ????? ???,????? ?????????,????? ?????? (???)
  • ???????????????
  • ?????????????,shmat (SHared Memory
    ATatch)????????
  • shared_memory (char ) shmat (id, NULL, 0)
  • Parameter 1 ????????????, Parameter 2
    ????????? (NULL the OS selects the location on
    the users behalf), Parameter 3 ???? (0 ?????)
  • ???????????????????,???????????,??shmat()
    ?????????????
  • Sprontf ( shared_mmory, Writing to shared
    memory)

32
  • ??????????????????,?????????
  • shmdt ( shared_memory)
  • ?????????? shmctl() ??????,??????????????????
    IPC-RMID

33
  • 3.5.1 POSIX ?????

34
  • 3.5.2 Mach
  • ????????????,???????Carnegie Mellon???????Mach????
    ?Mach??????????????,?????????,????????????
  • Mach???????(???????????????????)???????????????(?M
    ach?????,port)?????
  • ?????????,?? (Kernel )????? (Notify)????????
  • ??????????????,????????????? (Notify port)
  • ????????????
  • msg_send() ??????????
  • msg_receive() ??????
  • msg_rps() ?????? (remote procedure call RPC)
  • port_allocation() ??????????????????????? (8?)

35
  • ??????????????,????????????????,????????????
  • ?????????????
  • ????n??
  • ?????,????
  • ??????,????????????????
  • ????

36
  • 3.5.3 Windows XP
  • Windows XP??????????????,????????????????????????
    ????Windows Xp ???????????,???????????????????????
    ???(subsystem)???????????WindowsXP??????????
  • ?Windows???????? ???????? (local procedure call
    facility, LPC) , ???????????????????
  • ??????????????????????????
  • ???????? ???????
  • ??????
  • ???????????????????
  • ???????????
  • ?????????????,???????????????????????
  • ?????????????????????????????????

37
  • Windows XP ?????,???????????????????
  • ???? ????????????????
  • ???? ?????? (section object) ????

38
3.6 ??-??????
  • 3.6.1 ??(Socket)
  • ??(Socket)??????????????????? (?????)?????????IP??
    ?????? (Port number)????
  • telnet ?????? 23, ftp 21, http 80
  • ?????????????????,??????????
  • ??1024?????

39
  • Java ???????????
  • ?????? (connection-oriented (TCP) socket),
    ??Socket????
  • ??????? (connectionless (UDP) sockets),
    ??DatagramSocket ??
  • MulticastSocket ??,??DatagramSocket
    ??????,?????????????????

40
(No Transcript)
41
(No Transcript)
42
  • 3.6.2 ??????(RPC)
  • RPC ????????????????????????,?????IPC?????,???????
    ?????????
  • RPC ????????????????????????????????
  • RPC ?????????? stub ??????
  • ??????????????????stub ,????????????,RPC ????????
    stub ,?????????????????
  • ??????????,?????????????
  • ?????
  • ????????,????????RPC????

43
  • 3.6.2 ??????(RPC)

44
  • 3.6.3 ??????(RMI)
  • ?????? (remote method invocation, RMI) ???? Java
    ??
  • RMI ???????????????????
  • ????????Java?????????????
  • RMI ? RPCs ?????????
  • RPCs ???????????,????????????????,RMI
    ??????,????????????
  • ?RPC ??????????????????,?RMI??????

45
  • ?? A ? B ?? someMethod () ????????stub
  • stub ??? A ? B ?????????????,?????
  • ????skeleton???????someMethod()
  • ????skeleton??? someMethod ??????????,??????????
  • ???? sub ?????,????????????
Write a Comment
User Comments (0)
About PowerShow.com