510 likes | 530 Vues
Chapter 3: Operating Systems. Computer Science: An Overview Tenth Edition by J. Glenn Brookshear. Chapter 3: Operating Systems. 3.1 The History of Operating Systems 3.2 Operating System Architecture 3.3 Coordinating the Machine’s Activities 3.4 Handling Competition Among Processes
E N D
Chapter 3: Operating Systems Computer Science: An OverviewTenth Edition by J. Glenn Brookshear
Chapter 3: Operating Systems • 3.1 The History of Operating Systems • 3.2 Operating System Architecture • 3.3 Coordinating the Machine’s Activities • 3.4 Handling Competition Among Processes • 3.5 Security
Functions of Operating Systems • Oversee operation of computer • Store and retrieve files • Schedule programs for execution • Coordinate the execution of programs
Famous OSs • Microsoft Windows • Unix based - Mac OS (Apple Mac) - Solaris (SunMicro system) - Linux - Antroid
Evolution of Shared Computing • (1)Batch processing - the executing jobs without interaction with users - Payroll system, print monthly report job • (2)Interactive processing • there’s interaction between users and computer • Requires real-time processing, normally 3-5 seconds response time is acceptable • Choosing curriculum
(3)Time-sharing/Multitasking • Implemented by Multiprogramming • Time is divided into intervals and executing each job at one interval • take turn to execute each job until all the jobs are executed • If used in a single-user environment is called multitasking
(4)Multiprocessor machines - assign different tasks to different processors - load balancing (dynamically allocating tasks to the various processors so that all processors are used efficiently) - scaling ( breaking tasks into a number of subtasks compatible with the number of processors available)
Network-wide operating system • As the computer network popular, a network of individual OS can share the loading of a big tasks- cloud computing
雲端運算(cloud computing),是分散式計算技術的一種,其最基本的概念,是透過網路將龐大的運算處理程序自動分拆成無數個較小的子程序,再交由多部伺服器所組成的龐大系統經搜尋、運算分析之後將處理結果回傳給用戶。 • 透過這項技術,網路服務提供者可以在數秒之內,達成處理數以千萬計甚至億計的資訊,達到和「超級電腦」同樣強大效能的網路服務。
The trend is to develop a single network-wide OS rather than a network of individual OS. • Yet, developing of OS for hand-held computing is needed • The challenge are limited data storage capability and power conservation requirements • Palm OS, Windows CE, Window Mobil, Antroid
Types of Software • Application software • Performs specific tasks for users • System software • Provides infrastructure for application software • Consists of operating system and utility software
Operating System Components • Shell: Communicates with users • Text based • Graphical user interface (GUI) -- Window manager • Kernel: Performs basic required functions • File manager • Device drivers • Memory manager • Scheduler and dispatcher
Figure 3.4 The shell as an interface between users and the operating system
Window manager • allocate blocks of space on the screen • Keeps track of which appilcation is associated with each window • When a mouse button is clicked, it compute the mouse’s location and notifies the appropriate application of the mouse action
File Manager • It keeps records of all the files stored in mass storage, including where each file is located, which users are allowed to access the various file and which portions of storage are available for news files…etc • Directory (or Folder): A user-created bundle of files and other directories (subdirectories) • Directory Path: A sequence of directories within directories
Device drivers • The software communicate with the controllers to carry out operations on the peripheral devices • Each device driver is uniquely designed for its particular type of device e.g. a printer driver can read and decode the particular printer’s status word and handshaking details.
Memory Manager • Allocates space in main memory • May create the illusion that the machine has more memory than it actually does (virtual memory) by playing a “shell game” in which blocks of data (pages) are shifted back and forth between main memory and mass storage
Getting it Started (Bootstrapping) • Bootstrap: Program in ROM (example of firmware) • Run by the CPU when power is turned on • Transfers operating system from mass storage to main memory • Executes jump to operating system
BIOS • Software routines for performing fundamental input/ output activities. • Stored in the ROM as well.
Special purpose computers • The functions are fixed, so they store all the program in their main memory where it is readily available each time the device is turned on. • Turnkey system
Processes • Process: The activity of executing a program • Process State: Current status of the activity • Program counter • General purpose registers • Related portion of main memory
Figure 2.4 The architecture of the machine described in Appendix C
Process Administration- Scheduler • Keep track of all the processes in the process table which reside in main memory. • Process table • Memory area assigned to a process • The priority of a process • Process status (ready, waiting) ready- the process can continue waiting- the process is waiting for external events occurs
Adds new processes to the process table • removes completed processes from the process table
Dispatcher • Controls the allocation of time slices to the processes in the process table • The end of a time slice is signaled by an interrupt. • Select the process from process table that has the highest priority among the ready processes to execute
Virtual reality • CNN beams up virtual correspondent • Star war • hologram
Handling Competition for Resources • An important task of an operating system is the allocation of the machine’s resources to the processes in the system. • Resource: CPU、main memory, mass storage, peripherals… • E.g. file manager allocates mass storage space for new files,scheduler allocates space in the process table…
flag • OS use a flag to keep track of whether the printer has been allocated. • Flag: a bit in memory whose states are set or clear. Set flag means it is taken, clear flag indicates it is available. • the process can use the resource only when the flag is ‘clear’.
Test and possibly setting problem • Process A is testing and finding that the flag is “clear”.. And about to change the flag to “set”.. An interrupt occurs • Process B requests the same resource and since the flag is clear, so it got the permission to use it. • When the time slice is up, an interrupt occurs, the status of computer restores, process A proceed to change the flag to set and start to print….both process A and B are using printer
Solutions • A. make the rule that during the test-possibly setting, the interrupt is disabled. • B. use “test-and-set” instruction to execute the it • C. Spooling
Critical Region: A group of instructions that should be executed by only one process at a time • Mutual exclusion: Requirement for proper implementation of a critical region
Regulation of semaphore • To enter the critical region, a process must find the semaphore clear and set the semaphore before entering the critical region; then upon exiting the critical region, the process must clear the semaphore.
Figure 3.7 A deadlock resulting from competition for nonshareable railroad intersections
Deadlock • Processes block each other from continuing • Conditions required for deadlock 1. Competition for non-sharable resources 2. Resources requested on a partial basis 3. An allocated resource can not be forcibly retrieved The deadlock problem can be removed by attacking any one of the three.
Deadlock detection and correction scheme • An allocated resource can not be forcibly retrieved • E.g. A process requires to create new process to perform subtasks while the process table is full. • OS detects the deadlock and KILL some processes in the process table
Deadlock avoidance scheme Condition 2: Resources requested on a partial basis e.g. To require each process to request all its resources at one time.
Competition for non-sharable resources • E.g. printer • Solution : spooling
手機也面臨病毒侵襲 • 專家稱有500種手機病毒 功能越接近電腦 威脅愈大 • 據聖荷西信使報報導,當電腦正在遭受越來越多的病毒侵襲之際,手機也和電腦一樣成為病毒攻擊的對象,而且受到的威脅越來越大。 • 報導認為,手機和電腦一樣,也面臨著各種病毒的威脅,特別是當手機功能越接近電腦功能時,其遭受病毒襲擊的可能性就越大。報導說,最著名的手機病毒也許是2005年發現的彩信木馬病毒commwarrior-a,它是全球第一個通過移動多媒體信息服務傳播的手機病毒。自那時以來,手機病毒迅猛增加。目前,網絡安全專家發現的手機病毒已經有500種左右。
Questions • A. Why a computer virus can attack Mobil phone? • B. How can a computer virus attack a Mobil phone? • C. Guess what system can be attacked most?
Security • Attacks from outside • Problems • Insecure passwords • Sniffing software-the software when left running on a computer records activities and reports them to a would-be intruder • Counter measures • Auditing software- record and analyze the activities taking place within the computer system
Password problem • What is a ‘good’ password?
Security (continued) • Attacks from within • Problem: Unruly processes- may try to trick MM into allowing a process to access MM cells outside it’s allocated area or retrieving files whose access should be denied. • OS designs a special register to keep the upper limit and lower limit of memory address of a process. • But then the unruly program may change the contents of the special register