College of Software Engineering Undergraduate Course Syllabus Course ID 311006040 Course Name Operating System Course Attribute Compulsory Selective Course Language English Chinese Credit Hour 4 Period 64 Semester First Fall First Spring Second Fall Second Spring Third Fall Third Spring Fourth Fall Fourth Spring Instructors Zhao Kui, Liang Gang, Hu Xiao-qin Description This course covers the fundamentals of Operating Systems and Systems Programming, revealing the mysteries of the software layer between application programs and hardware, and covering techniques and algorithms for dealing with thorny problems of resource management, sharing, and protection, as well as concurrency and complex systems. Perhaps best of all, four programming projects give students the chance to implement important and realistic subsystems of a small operating system kernel. Between the lectures, reading, and programming assignments, we hope that the course will help students become not only an OS expert and/or kernel hacker, but also a better programmer and user of computer systems, and a better computer scientist who has insight into managing complex and concurrent interactions within and between hardware and software systems! Prerequisites C Language Programming Computer Architecture Data Structures and Algorithms Textbook William Stallings, Operating Systems Internals and Design Principles (Fifth Edition),Publish House of Electronics Industry,2007
Course Webpage: cs.scu.edu.cn/~zhaokui All vital information will appear on the course webpage, including lecture notes and programming assignments. Mailing list: zhaokui@cs.scu.edu.cn lianggang@cs.scu.edu.cn huxiaoqin@cs.scu.edu.cn The staff email is where you should send questions regarding course administration and any questions which would be inappropriate if posted publicly to the newsgroup (i.e. questions that contain your code or other private information). Reference: 1. Computing Operating System tangziyin, Xian University of Electronic Science and Technology Press, 2004,Edition 3. Resource 2. Operating SystemDesign and ImplementationAndrew S.Tanenbaum,Pulishing House of Electronics Industry1998Edition 2. 3. Operating SystemHarvey M.Deitel, Tsingha University Press2007Edition 3. 4. Operating System Concepts James L.Peterson Addison-Wesley Publishing Company2001,Edition 6. 5. Operating Systems Concepts, Abraham Silberschatz, Peter Galvin, and Greg Gagne, John Wiley and Sons, Higher Education Press, 2002Edition 6. 6. Operationg System Excise and Analyze ZengPingTsingha University Press 2001Edition 1 7. Williamstallings.com/os/os5e.html 8. Comp.os.research 9. comp.os.misc 10. comp.unix.internals 11. comp.os.linux.development.system 12. http://ocw.zju.edu.cn/ocwweb/index.jsp Grading Class participation and homework (30%), final exam (50%), course practice(20) 2
The lecture of this course will cover the following topics: 1. Computer System Overview (1 credit hours).overview of computer architecture and organization; Computer-System Operation; Interrupts; The memory of hierarchy; I/O communication techniques 2. Operating System Overview (3 credit hours) History of operating system; Operating system concepts, objective and function; Introduction of the type of Operating system including multiprogramming system, Real-Time System, Batch system, Time-sharing system, Distributed operating system, Network operating system Overview of the modern operating system structure; Topics (48 credit hours) 3. Process Description and Control (5 credit hours) The concepts of process including states and its transitions, PCB; The operations on processes and process states; Introduction of process control; 4. Threads, SM and Microkernels ( 5 credit hours ) Thread definition, creation, manipulation, User and Kernel Thread.; The concept of SMP and the management of SMP; Microlekernels definition, objective; 5. Concurrency ( 9 credit hours ) The conceptions of concurrency and the implication of execution of multiple concurrent process; The hardware mechanisms that support mutual exclusion; Three operating system and programming language mechanisms used to provide concurrency; Introduction two problems of concurrency: deadlock and starvation and solutions of these two problems. 6. Memory ( 9 credit hours ) Memory organization and management; 3
Paging and segmentation, address mapping; Virtual memory concepts; Virtual memory management, page replacement algorithms. 7. Scheduling (9 credit hours ) Basic Concepts (including Long-term scheduling, Medium-term scheduling, Short-term scheduling.); Scheduling algorithms(including First-Come-First-Served (FCFS), Priority, Round-Robin ); Multiprocessor scheduling; Real-Time Scheduling; 8. Input/Output Device ( 4 credit hours ) The concepts relation to I/O devices and the classification of the I/O devices; The task and function of the I/O device management; The data structure and algorithms relation to I/O device management; The virtual device techniques; 9. File Management ( 3 credit hours ) File Concept, Access Methods, Directory Structure, File Sharing and Protection File-System Structure, File-System Implementation, Directory Implementation, Allocation Methods, Free-Space Management. Tools & Environment Windows XP, Redhat linux 9.0, Vmware virtual machine, gcc, g++ Lab 1: Develop a shell in Nachos Projects ( 16 credit hours ) Design a simples command line shell that has following properties: 1. The shell must support the following internal commands: cd, dir, clr,environ, echo,help,pause and quit; 2. All other command line input is interpreted as program invocation which should be done by the shell forking and executing the programs as its own child processes; 3. The shell must be able to take its command line input from a file; 4
4. The shell must support i/o redirection on either or both stdin and/or stdout; 5. The shell must support background execution of programs. 6. The command line prompt must contain the pathname of the current directory. Write a simple manual describing how to use the shell. The manual should contain enough detail for a beginner to linux to use it; The source code must be extensively commented and appropriately structured to allow your peers to understand and easily maintain the code; Details of submission procedures will be supplied well before the deadlines; The submission should contain only source code files, include files, a makefile and the readme file. Lab 2: Upgrade the Nachos thread management model Modify the source code of the Nachos to achieve the following objectives: Expand thread data structure and add the "user ID, thread ID" two members of the data structure of Nachos. Meanwhile, add the safeguard mechanism of these two data members in the Nachos existing thread management model; Expand the existing state of threads. There are only new, ready, block and running four states in Nachos. Please add "suspending" state in Nachos. The so-called "hang up" refers to the current thread disk image stored in documents rather than memory. "Suspend" state is the important foundation of the future realization of virtual memory management. Modify thread scheduling algorithm. Change the thread management mechanism to the "preemptive." You can add "timing" and "priority scheduling," "Multi-Queue" different algorithm into Nachos thread management model. Add the global thread management mechanism and expand the existing operations command in Nachos. For example, you can add a command called "ThreadView" in order to show the current existence of all the threads of information, including the "user ID", "Thread ID", "Current status" on the screen. Design a mutual exclusion and synchronization example. After the above modifications, you can design a program to implement one mutual exclusion and synchronization classic solution. For example, you can choose "philosopher dining" problem and create five philosopher threads which have same user ID and follow the "signal of" mechanisms to correct the operation in your program. You can also choose "producers - consumers", "Sleep Barber of Seville" and other classic IPC problems to 5
finish this task. Lab 3: Upgrade the Nachos File management model Modify the source code of the Nachos to achieve the following objectives: Add longer document name support and the following described information in Nachos kernel. File Types Create time Document the last visit time File trails Achieve dynamic content distribution according to the file size. Now Nachos allocate the space according to the designated size of when creating a file and if we want to amend file, we are limited to allocated space. So, modify the kernel to satisfy the dynamic distribution. Modify the file index means in Nachos to achieve unlimited length of documents. You can refer to the file index mechanism of Unix to achieve this requirement. Modify the directory structure to implement multi-level directory which there is no restriction on the number of the files. Achieve synchronous operation of the file system. Directory files, bitmap files are all critical resources and they do not allow multiple processes at the same time visit. The current system did not impose synchronous control, so, modify this defect. Lab 4: Upgrade the Nachos Memory management model Modify the source code of the Nachos to achieve the following objectives: Add the data structure to describe the process of memory and the corresponding relations. That is, add the process ID member in memory describing structure and it can make understand the distribution of memory easily and facilitate to measure the performance of memory management. Achieve the multi-programming, which there are multiple programs co-exist in memory. Modify the Nachos to support virtual memory. Nachos only support the process which it s size is not more than the size of the memory. If the size of process is more 6
than the size of the memory, it will not be execute. So, amend this defect to support big size process. Implementation monitoring thread and it can real-time reflect the use of memory. Version No 1.0 Author Kui Zhao Date2008-7 -15 Auditor Mei Hong Date2008-7-25 Signature of leader Date2008-7-30 7