?2? ???? ?? (Process Management) - PowerPoint PPT Presentation

1 / 84
About This Presentation
Title:

?2? ???? ?? (Process Management)

Description:

2 (Process Management) (program in execution) CPU time, memory, files, I/O devices – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 85
Provided by: Meey8
Category:

less

Transcript and Presenter's Notes

Title: ?2? ???? ?? (Process Management)


1
?2? ???? ?? (Process Management)
  • ????
  • ???? ????(program in execution)
  • CPU time, memory, files, I/O devices ? ?? ??
  • ???? ???? (the unit of work)
  • ??
  • 1. ??? ????(user process) - user code ??
  • 2. ??? ????(system process) - system code ??
  • ???? ??
  • ??? ????? ??? ????? ??? ??
  • ???? ????
  • ?????? ??? ?? ??
  • ?????? ?? ??
  • ?????? ????(deadlock)??

2
Chapter 3. ???? ??(Process Concept)
  • Questions of the day
  • ????? ? ? ?? ?????
  • Linux ? ????? ???? PCB(Process Control Block) ???
    ????
  • Unix/Linux ????? ???? ??? ????
  • ???? ????? ???? ???
  • ????? ??(context)? ??? ???
  • ??? ??? ??? ??? ? ?? ???-??? ??? ?? ?????? ???
  • ?? ?? ???-??? ?? (bounded buffer
    producer-consumer problem) ?????

3
???? ??(Process Concept)
  • ?? 1 program ?? ? ??? multiple program? ?? ??
  • ???? (The Process)
  • ???? ?? ?? ??(Current activity)
  • PC(Program Counter)
  • ???? ?
  • ??(stack) ????, ????, ????, ???? ?
  • ??? ??(data section) ????
  • ???? ??(Process State)
  • ??(new)
  • ??(running) CPU? ??
  • ??(waiting) I/O??? signal ???
  • ??(ready) Processor? ?? ??? ?
  • ??(terminated)

4
Process in Memory
5
???? ??(Process State)
6
(??) Linux ?? ??? ??
  • ??? ????? 4GB ?? ??? ??
  • ? ????? 3GB ??
  • ??? 1GB? ?? ????? ?? ????? ?? ???? ??

cat /proc/1/maps
BSS(Block Started by Symbol)
7
(??) Linux ??? ?? ????
  • task_struct ????? struct mm_struct mm
  • /usr/src/kernels/linux-2.6.35.6/include/linux/sche
    d.h (1256? Fedora Linux 2.6.38.6)
  • /usr/src/kernels/linux-2.6.35.6/include/linux/mm_t
    ypes.h (222?, 131?)
  • ??? ?????

8
???? ??(Process Concept)
  • ???? ?? ??(Process Control Block) ? /proc ??
  • ? ????? PCB? ???
  • Solaris 10 Unix /usr/include/sys/proc.h (99?)
  • Fedora Linux /usr/src/kernels/linux-2.6.38.6/incl
    ude/linux/sched.h (1193?)
  • PCB
  • ???? ?? new, ready, running, waiting, halted
  • ???? ??? next instruction? ??
  • CPU????? accumulator, index register, stack
    pointers, ?? registers, condition-code
  • CPU??? ?? priority, pointers to scheduling
    queues
  • ??? ?? ?? base and limit registers, page tables,
    segment tables
  • ?? ?? time used, time limits, account numbers,
    job, process
  • ??? ?? ?? I/O devices list allocated to the
    process, list of open files
  • ???(Threads)
  • a process a single thread of execution (one
    task)
  • ?? ?? OS?? multiple threads of control
    (multitasks at a time) ??

9
Process Control Block (PCB)
10
Linux task_struct ???
  • ???? ?? ?? ??
  • ????? ???? task_struct ???? ?? ????? ?? ???
    ???? ??
  • ?? ?????? ??? ??
  • /usr/src/kernels/linux-2.6.38.6/include/linux/sche
    d.h (1193?)
  • ??? ID, ?? ??, ?? ??,??, ???, ???, ????,CPU ???
    ? ?? ????? ? ??? ???? ?? ??? ??
  • alloc_task_struct ???? ?? ?? ??? ????? 8KB? ????
    ???? ?????? ?? ??? ??? ??
  • current ?? ???? ?? ???? ???? ??
  • /usr/src/kernels/inux-2.6.38.6/arch/x86/include/as
    m/current.h (17?)

?? ??? ???? ?????
11
Linux task_struct ???
  • ??? ??? ??? ???
  • p_opptr? p_pptr ?? ???
  • p_oppr Original Parent
  • p_cptr ??, p_ysptr ??, p_osptr ?
  • ??? ???? ?? ????? ?? ?? ?? ???? ??
  • SET_LINKS ???? ???? ???
  • REMOVE_LINK ???? ???? ???

struct task_struct p_opptr, p_pptr, p_cptr,
p_ysptr, p_osptr
struct task_struct next_task, prev_task
task_struct ???
12
???? ????(Process Scheduling)
  • ???? ?(Scheduling Queues)
  • ?? ? (job queue) memory ?? ???? ?(disk??)
  • ?? ? (ready queue) CPU? ?? ???? ?
  • ?? ? (device queue() ??? ???? ?
  • ?? ?? (queueing diagram) ?? 3.7
  • ????(Schedulers)
  • ?? ????(long-term scheduler, job scheduler)
  • pool ? memory(degree of multiprogramming)
  • Unix ?? ??? ????? ??
  • ?? ????(short-term scheduler, CPU scheduler)
  • CPU ?? must be very fast
  • ?? ????(medium-term scheduler)
  • swapping
  • degree of multiprogramming? ??
  • memory ? backing store

13
???? ??? ??? ?? ?
14
???? ????? ???? ?? ??
15
?? ??? ?? ????(Medium Term Scheduling) ??
16
???? ????(Process Scheduling)
  • ?? ??(Context Switch)
  • CPU? ? process?? ?? process? switch? ?
  • save the state of the old process CPU? ???
    ??(PCB??)
  • load the saved state for new process CPU? ???
    ??(PCB??)
  • pure overhead performance bottleneck ? threads?
    ??
  • context-switch time 1-1000microsecond
  • address space ?? ?? memory ????? ??

17
? ?????? ?? ?????? CPU Switch
18
????? ?? ?????(Operations on Processes)
  • ???? ??(Process Creation)
  • ???? ?? ??? ?? fork, exec, CreateProcess, etc.
  • ?? ????
  • ?? ???? ?? ??? ?? ????? ??(memory, files) ??
  • ? ???? ?? ? ???
  • ?? ??
  • ?? ??? ?? ? ?? ??? wait system call?

19
???? UNIX System? ???? ??
ps
Write a Comment
User Comments (0)
About PowerShow.com