http://www.scs.stanford.edu/10wi-cs140/pintos/pintos.html#SEC_Top
this is manual of "pintos Operating System"
이 블로그 검색
2012년 3월 30일 금요일
Process Concept
| Process in Memory |
Process Concept
- An operating system executes a variety of programs:
- Jobs for batch system
- User program/ tasks for time-sharing system
- Textbook uses the terms "job" and "process" almost interchangeably
- Process - a program in execution; process execution must progress in sequential fashion
- A process includes:
- program counter
- stack
- data section
Process State
- new : The process is being created
- running : Instructions are being executed
- waiting : The process is waiting for some event to occur
- ready : The process is waiting to be assigned to a process
- terminated : The process has finished execution
| Diagram of Process State |
참고 : Operating System Concepts by WILEY
Buffering & Spooling
Buffering
Buffering은 I/O channel을 통하여 data가 buffer에 저장된 후,CPU가 buffer에 접근하여
연산을 수행하도록 한다. CPU가 buffer를 접근하는 동안 I/O channel을 통하여 data를 입력하는
것은 불가능하지만 CPU가 연산을 수행하는 동안에는 입력하는 것이 가능하다.
따라서, buffer가 하나일 경우에는 CPU가 buffer에 접근하는 동안 I/O device는 idle 상태에
있게 된다. 그러나 buffer를 두 개 사용하는 double buffering에서는 CPU가 하나의 버퍼에 접근하는
동안 다른 버퍼는 다음 data를 계속 입력받음으로써 CPU의 동작과 I/O device의 동작을 동시에
수행할 수 있게된다. circular buffering은 이러한 개념을 확장하여 세 개이상의 buffer를 사용한다.
출력도 이와 유사한 buffering을 할 수 있다.
Spooling (Simultaneous Peripheral Operation On-line )
buffering은 I/O device마다 buffer를 두지만 spooling은 disk를 하나의 매우 큰 buffer처럼 사용하며
disk를 통하여 I/O를 수행한다.
Comparison
buffering과 spooling은 모두 I/O device와 CPU간의 속도 차이를 줄여 CPU 이용률을 개선하기 위한
방법이다. buffering은 단지 하나의 작업의 I/O와 CPU 연산을 동시 수행할 수 있지만 spooling은 여러 작업들간의 I/O와 CPU 연산을 동시에 수행할 수 있다. 따라서 spooling은 buffering에 비하여 system 성능에 직접적인 향상 효과를 일으킬 수 있다.
[출처] [ 운영체제 ] Buffering 과 Spooling|작성자 침해사고대응팀장
Operating-System Structure
Operating-System Structure
1. Simple Structure
- MS-DOS - Written to provide the most functionality in the least space
- Not divided into modules
- Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated
2. Layered Approach
- The operating system is divided into a number of layers (levels), each built on top of lower layers
- The bottom layer (layer 0) is the hardware, the highest (layer N) is the user interface
- With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers
- #UNIX - limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts
| UNIX System Structure |
3. Microkernel System Structure
- Moves as much from the kernel into "user" space
- Communication takes place between user modules using message passing
- Benefits:
- Easier to extend a mocrokernel
- Easier to port the operating system to new architectures
- More reliable (less code is running in kernel mode)
- More secure
- Detriments:
- Performance overhead of user space to kernel space communication
4. Modules
| Solaris Modular Approach |
- Most modern operating systems implement kernel modules
- Uses object-oriented approach
- Each core component is separate
- Each talks to the others over known interfaces
- Each is loadable as needed within the kernel
- Overall, similar to layers but with more flexible
Virtual Machines
| Virtual Machines |
- A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware
- A virtual machine provides an interface identical to the underlying bare hardware
- The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory
- The resources of the physical computer are shared to create the virtual machines
- CPU scheduling can create the appearance that users have their own processor
- Spooling and a file system can provide virtual card readers and virtual line printers
- A normal user time-sharing terminal serves as the virtual machine operator's console
- The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources
- A virtual-machine system is a perfect vehicle for operating-systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation
- The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine
| The Java Virtual Machine |
| VMware Architecture |
참고 : Operating System Concepts by WILEY
Operating System Services and User Interface
Operating System Services
- One set of operating - system services provides functions that are helpful to the user
- User interface : CLI (Command-Line Interface), GUI (Graphics User Interface), BPS (Batch Process System)
- Program execution
- I/O operations
- File-system manipulation
- Communications
- Error detection
- Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing
- Resource allocation
- Accounting (to record using time)
- Protection and Security
User Operating System Interface
- CLI
- Sometimes implemented in kernel, sometimes by systems program
- Sometimes multiple flavors implemented - shells
- Primarily fetches a command from user and executes it
- GUI
- User-friendly desktop metaphor interface
- Many systems now include both CLI and GUI interfaces
- Microsoft Windows is GUI with CLI "command"shell
- Apple Mac OS X as "Aqua" GUI interface with UNIX kernel underneath and shells available
- Solaris is CLI with GUI interfaces (Java Desktop, KDE)
참고 : Operating System Concepts by WILEY
System Call
- Programming interface to the services provided by the OS
- Typically written in a high-level language (C or C++)
- Mostly accessed by programs via a high-level Application Program Interface(API) rather than direct system call use
- Three most common APIs are Win32 API for Windows, POSIX API for PISIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM)
System Call Implementation
- Typically, a number associated with each system call
- System-call interface maintains a table indexed according to these numbers
- The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values
- The caller need know nothing about how the system call is implemented
- Just needs to obey API and understand what OS will do as a result call
- Most details of OS interface hidden from programmer by API
- Managed by run-time support library (set of functions built into libraries included with compiler)
C program invoking printf() library call, which calls write() system call
Standard C Library Example
참고 : Operating System Concepts by WILEY
Operating System Structure & Activities
Operating System Structure
- Multiprogramming - One job selected and run via job scheduling
- Timesharing(multitasking) - Timesharing is logical extension in which CPU switches jobs so frequently that users can interact with each jab while it is running, creating interactive computing
Operating-System Operations
- Interrupt driven by hardware
- Software error or request creates exception or trap
- Other process problems include infinite loop, processes modifying each other or the operating system
- Dual-mode - Dual-mode operation allows OS to protect itself and other system components
- User mode and Kernel mode
- Mode bit povided by hardware
- user mode : 1 (included typical codes)
- kernel mode : 0 (included I/O codes)
- Timer - To prevent infinite loop/process hogging resources
- Set interrupt after specific period
- Operating system decrements counter
- When counter zero generate an interrupt
- Set up before scheduling process to regain control or terminate program that exceeds allotted time
Operating-System Activities
- Process Management Activities
- Creating and deleting both user and system processes
- Suspending and resuming processes
- Providing mechanisms for process communication
- Providing mechanisms for deadlock handling
- Memory Management Activities
- Keeping track of which parts of memory are currently being used and by whom
- Deciding which processes(or parts thereof) and data to move into and out of memory
- Allocating and deallocating memory space as needed
- Storage Management Activities
- Creating and deleting files and directories
- Primitives to manipulate files and dirs
- Mapping files onto secondary storage
- Backup files onto stable storage media
- Mass-Storage Management Activities
- Free-space management
- Storage allocation
- Disk scheduling
- Caching
- Important principle, performed at many levels in a computer(in hardware, operating system, software)
- Information in use copied from slower to faster storage temporarily
- Faster storage (cache) checked first to determine if information is there
- If it is, information used directly from the cache (fast)
- If not, data copied to cache and used there
- Cache smaller than storage being cached
- Cache management important design problem
- Cache size and replacement policy
- I/O Subsystem
- One purpose of OS is to hide peculiarities of hardware devices from the user
- I/O subsystem responsible for
- - Memory management of I/O including buffering, caching, spooling
- #buffering is storing data temporarily while it is being transferred
- #spooling is the overlapping of output of one job with input of other jobs
- - General device-driver interface
- - Drivers for specific hardware devices
참고 : Operating System Concepts by WILEY
2012년 3월 25일 일요일
How a Modern Computer System Works
How a Modern Computer System Works
- I/O devices and the CPU can execute concurrently
- Each device controller is in charge of a particular device type
- Each device controller has a local buffer
- CPU moves data from/to main memory to/from local buffers
- I/O is from the device to local buffer of controller
- Device controller informs CPU that it has finished its operation by causing an interrupt
Direct Memory Access Structure
- Used for high-speed I/O devices able to transmit information at close to memory speeds
- Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
- Only one interrupt is generated per block, rather than the one interrupt per byte
참고 : Operating System Concepts by WILEY
Outline of Operating System
What is an Operating System?
- A program that acts as an intermediary between a user of a computer and the computer hardware
- Execute user programs and make solving user problems easier
- Make the computer system convenient to use
- Use the computer hardware in an efficient manner
- Hardware
- CPU, memory, I/O devices
- Operating system - Controls and coordinates use of hardware among various applications and users
- Application programs
- Users
- People, machines, other computers
- Resource allocator - manages and allocates resources
- Control program - controls the execution of user programs and operations of I/O devices
- Kernel - the one program running at all times
참고 : Operating System Concepts by WILEY
피드 구독하기:
글 (Atom)