100 likes | 111 Vues
Chapter 2: Introduction to Operating Systems. 이준희 (jvl@tcs . snu.ac.kr ) School of Computer Science and Engineering Seoul National University. Contents. Introduction to Operating Systems Introduction Virtualizing the CPU Virtualizing Memory Concurrency Persistence Design Goals
E N D
Chapter 2:Introduction to Operating Systems 이준희(jvl@tcs.snu.ac.kr) School of Computer Science and Engineering Seoul National University
Contents • Introduction to Operating Systems • Introduction • Virtualizing the CPU • Virtualizing Memory • Concurrency • Persistence • Design Goals • Some History
Introduction • Operating System • A body of software that is responsible for making it easy to run programs, allowing programs to share memory, enabling programs to interact with devices. • System Calls • The OS provides some interfaces (APIs) to runprograms, access memory and devices, and other related actions. • Abstraction establishes a level of complexity on which a person interacts with the system. Source: http://upload.wikimedia.org/wikipedia/commons/6/68/Linux_kernel_interfaces.svg (Retrieved 2015.04.22)
Introduction • Virtualization • The OS takes a physical resource and transforms it into a more general, powerful, and easy-to-use virtual form of itself. • Resource Manager • Each of the CPU, memory, and disk being a resource of the system, the operating system manages those resources efficiently or fairly.
Virtualizing the CPU • Illusion • Turning a single CPU into a seemingly infinite number of CPUs. • Policy • Basic mechanisms that OSs implement to answer ‘question’s. • Allowing many programs to seemingly run at once. $ gcccpu.c –o cpu $ ./cpu j & ./cpu v & ./cpu l [1] 10360[2] 10361vjljvljvl^C $ main() of cpu.c: 1 intmain(intargc, char *argv[])2 {3 inti = 0;4 while(1)5 {6 printf(“%s\n”, argv[1]);7 sleep(1);8 }9 return 0;0}
Virtualizing Memory • Physical Memory • an array of bytes • One must specify an address/data to be able to read/write(update) memory. • (Virtual) Address Space • The OS maps onto the physical memory of the machine. • The running program has physical memory all to itself, not affecting the address space of other processes. • However, physical memory is a shared resource.
Concurrency • A host of problems that arise, and must be addressed, when working on many things at once in the same program. • Atomicity • If a set of operations appears to the rest of the system to occur instantaneously. • Either successfully change the state of the system, or have no apparent effect.
Persistence • Storing files safely over the long-term. • File system • the software in the operating system that usually manages the disk. • The OS does not create a private, virtualized disk for each application. • Journaling • a chronological record of data processing operations that may be used to construct or reinstate an historic or alternative version of a computer file. • Copy-on-write • Whenever a task attempts to make a change to the shared information, it should first create a separate copy of that information.
Design Goals • Providing: • high performance = minimization of the overheads of the OS • protection between applications / OS and applications • a high degree of reliability • energy-efficiency, security, mobility, …
Some History • Hardware privilege level • different levels of access to resources • Kernel mode • The OS has full access to the hardware of the system. • User mode • The hardware restricts what applications can do. • Memory protection • not allowing one program to access the memory of another program Source: http://blog.codinghorror.com/understanding-user-and-kernel-mode/ (Retrieved 2015.04.22)