Chulalongkorn University: Faculties and Staffs'...
Transcript of Chulalongkorn University: Faculties and Staffs'...
Content
Chapter 1: IntroductionChapter 2: Operating-System StructuresChapter 3: ProcessesChapter 4: ThreadsChapter 5: Process SynchronizationChapter 6: CPU SchedulingChapter 7: DeadlocksChapter 8: Main MemoryChapter 9: Virtual MemoryChapter 10: Mass Storage StructureChapter 11: File-System InterfaceChapter 12: File-System ImplementationChapter 13: I/O SystemsChapter 14: ProtectionChapter 15: Security
Textbooks
Website
http://pioneer.netserv.chula.ac.th/~achatcha/
VirtualBox
VirtualBox(user program)
hardware
operating system (Windows)
VM1 VM2 VM3
userprogram
userprogram
OS3OS2OS1
Linux Windows
Linux Distro
Quiz: process managementShow kernel versionShow kernel (file) and its size.Show CPU information.Run a process with lowest priority (least favorable).Run a process (> 60 sec), pause, and resume.Run a process (> 60 sec) in background, and terminate.Run two processes and connect them using a pipe.Run three processes in background, and bring the second to the front.Run three processes in background, and terminate the first.Show uptime (elapsed time since booting).
ใช ้sleep
Quiz: memory managementShow memory information.Show amount of free and used memory in the system.
Quiz: Storage managementMake a file, rename, and delete.Make a folder, rename, and delete.Make a file and change permission so that only the owner can read. Make a file and change both owner and group to “root.”Create a symbolic link.Show disk space (harddisk) usage in human-readable format.Show file space usage of “/usr/share/dict/american-english” in human-
readable format. ตอ้งติดตัง้ package ช่ือ wamerican ก่อนCheck and repair file system on harddisk.Search for a given filename.
Quiz: User managementChange password.Show on-line users.Show current users on the system and what they are doing.Enable administrator (root or superuser) account.Add a new user and remove.
Quiz: Network managementRemote login to Linux (ใชโ้ปรแกรม PuTTY).Transfer a file to Linux (ใชโ้ปรแกรม FileZilla)
Show IP address of your computer.Show IP address of google.co.th.Show MAC address of your host computer.Show connection speed to google.co.th.Download a file (https://.../file.zip) at 0.00AM.
Quiz: Utility (1)Show the manual page of “man” command.Make a beep sound using “echo”.Change font color to green and background color to black.Show only the first 10 lines of /etc/passwd.Show only the last 10 lines of /etc/passwd.Show only the line containing “sys” in /etc/passwd.Show only the line ending with “land” in /usr/share/dict/american-english.Count the number of lines in /usr/share/dict/american-english.Open /usr/share/dict/american-english in a text editor, and search for
“microcomputer”.Make a text file, put your firstname, save and display each character
sequentially in hex.Make a text file, put your firstname, encrypt with password protection.Write a hello-world program in C, compile, and execute.Run a process that will continue after logout.Shutdown in the next 10 minutes.
Quiz: Utility (2)Make a folder with a file inside and compress it to “foldername.tar.gz.”Make a folder with a file inside and compress it to “foldername.zip” and
make a checksum.Make two files, concatenate them together using “cat” “>” and “>>”.Split /usr/share/dict/american-english into 10 files (x00 to x99).Show only the first column in /etc/passwd.Show printer queue.Show current date & time.Show calendar.
สัดส่วนคะแนนคะแนนเก็บครึง่เทอมแรก 25%คะแนนสอบกลางภาค 25%คะแนนเก็บครึง่เทอมหลงั 25%คะแนนสอบปลายภาค 25%
การประเมนิผลการศกึษา≥ 85 ได ้A≥ 80 ได ้B+≥ 75 ได ้B≥ 70 ได ้C+≥ 65 ได ้C≥ 60 ได ้D+≥ 55 ได ้D> 55 ได ้F
5233692323 ยิ่งยง เตชะยิ่งยงชยั, 5233691723 เมธิณี อนวชักลุCake decoration game for multi-touch screens
จุฬาวิชาการ
5633661223 จิราย ุช่างคิด, 5633667023 ชินวฒัน์ องอาจVirtual Reality Broom Riding Game
5633684723 นารรีตัน ์พรมสา, 5633680123 ธนาพจน ์อภิรกัษเ์สนาMobile Application : The Secret Chamber
จุฬาวิชาการ
Introduction
Operating System
CPU Memory StorageI/O
devicesetc.
User program
User program
User program
User program
Manage resourcesProvide services
Introduction
Types of operating systems
1. No operating systems2. Batch processing3. Single-tasking4. Multi-tasking5. Time-sharing
Operating systems on PCs
1. DOS2. Windows 3.113. Windows 95, 98, ME, XP, Vista, 74. Unix, Linux (GNU – GNU is Not Unix)
No operating systems
1. Connect the robot to PC.2. Load a program into robot’s memory.3. Set program counter (PC) to start address4. Execute the program.5. Halt.
เคร่ืองใช้ไฟฟ้างา่ยๆ เช่น ทวีี ตู้เยน็มโีปรแกรมทีท่ างานเพยีงโปรแกรมเดยีวไม่จ าเป็นต้องม ีOS
Batch processing
1. input (storage)2. job control (a file)
- commands- output (storage, printer)
operating system(job queue)
A job
HardwareCPU
MemoryStoragePrinter
Cooperative multi-tasking
Time
CPU
idle
idle
idle
idle
Advantage: reduce I/O waiting.
Disadvantage: a long execution can block other processes.
Single-tasking
Multi-tasking
Preemptive multi-tasking(time sharing)
Time
CPU
3 jobs (assume no I/O wait) are submitted almost at the same time(first-come, first-serve).
Advantage: quick response for all users/processes.
This can be done by timer interrupt.
Time slice
OS
P1
P2
1
2
31. OS ตัง้ timer interrupt
แลว้กระโดดไปท า P12. เกิด timer interrupt
OS ยดึ CPU กลบัไปคืน3. OS ตัง้ timer interrupt
แลว้กระโดดไปท า P2
CPU ตอ้งมีฮารด์แวรท่ี์เป็น timer interruptเพ่ือสนบัสนนุ OS ท่ีท างานแบบ time sharing
DOS• single-user, single-task (no multi-tasking)• only text mode, no GUI
Windows 3.1x• Graphical user interface (GUI)• Cooperative multi-tasking
Windows 3.1 uses cooperativemultitasking - meaning thateach application that is in theprocess of running is instructedto periodically check a messagequeue to find out if any otherapplication is asking for use ofthe CPU and, if so, to yieldcontrol to that application.However, many Windows 3.1applications would check themessage queue onlyinfrequently, or not at all, andmonopolize control of the CPUfor as much time as theyrequired. A preemptivemultitasking system likeWindows 95 will take CPUcontrol away from a runningapplication and distribute it tothose that have a higherpriority based on the system'sneeds.
Windows 95• preemptive multi-tasking (time sharing)
iOS เวอรช์นัแรก ๆ ยงัไม่เป็น time-sharing เพลงจะหยดุเล่น เม่ือสลบัไปใช ้web browser
Linux• GUI is optional. • preemptive multi-tasking (time sharing)
Process & Thread
A process is a program loaded and being executed on computer.
A thread is a light-weight process.(เหมือนมี main function หลายๆ อัน)
P1
T1 T2 T3kernel
free memory
process A
process B
No memory protections among threads under the same process.A program can produce multiple processes.