이 글은 서울대학교 평생교육원 열린강좌 중, 홍성수 교수님의 운영체제 강의 및 pt자료를 정리한 내용임을 알려드립니다.
서울대학교 평생교육원 열린강좌 - 운영체제 (홍성수 교수님)
Processes and Threads
Agenda
- Process Concepts
- Process Scheduling
- Context Switching
- Process Creation and Termination
- MultiThreading
- Conclusion
Context Switching
Context Switching (1)
How does the dispatcher save and restore state?
- Mechanism : Context switch
- memory context : code, stack, data => 부분적
- h/w context : cpu, i/o, register => 반드시 대피
- sytem context : kernel process를 위한 저장내용 => 대피안함
- 대피의 판단기준은 사라지거나 overwrite되는 것들.
What must get saved?
- Everything that next process could or will damage
- Program counter
- Processor status word ( condition codes, etc. )
- General purpose registers, floating-point registers
- All of memory?
- Swapping : memory could be large so saving it could be expensive.
- Everything that next process could or will damage
Context Switching (2)
- Possibilities:
- Don’t save memory
- No dynamic memory management
- Memory is alloated to entire batch.
- Old batch processing system : multiprogrammed batch monitor.
- Context switching in multithreaded process
- No dynamic memory management
- Don’t save memory
Context Switching (3)
- Save all memory to disk ( roll-in/roll-out swapping )
* Bringing in each process entirely, running it an then putting it back on the disk,
* so, that another program may be loaded into that space.
* Early personal computer/workstation : DOS
* Effective but very slow.
Context Switching (4)
- Save part memory to disk (swapping)
- Moving memory blocks of pocess between RAM and disk
- swap file, swap device
- Implemented with memory complex management mechanusms
- Used in most of the modern OSes
- UNIX or UNIX-like systems : Linux, OS X
- Moving memory blocks of pocess between RAM and disk
Implementation
- Mechine dependent
- Different for MIPS, SPARC, x86, etc.
- Tricky
- OS must execute code to save state without changing the process’ state
- Requires some special hardware support
- Example : Save PC and PSR on trap or interrupt.
Mechanism (1)
- Stack frames during a ontext switch (80186/80188 Small)
Mechanism (2)
'코딩이야기 > 운영체제' 카테고리의 다른 글
파일 시스템(File system) - 2. big picture (0) | 2016.04.11 |
---|---|
파일시스템(File system) - 1. files and directories (0) | 2016.04.11 |
04-4.Processes and Threads - Process creation and Termination (0) | 2016.02.19 |
04-2.Processes and Threads - Process Scheduling (0) | 2016.02.16 |
04-1.Proceses and Threads - Process concepts (0) | 2016.02.15 |