Download presentation
Presentation is loading. Please wait.
1
Lecture 3: Basic OS Concepts
2
Review: Operating Systems History
: Batch Systems – Cards : Spooling Batch Systems – Tapes 1960- : Multiprogramming 1970- : Timesharing 1990- : Real-time, Distributed 2005-: WebOS (Web2.0, etc) 2007-: Mobile OS All programming was done in absolute machine language, vacuum tubes vs transistor
3
Review: The Operating System Zoo
Personal computer operating systems Single user (usually) MS-DOS, Windows, Linux Server operating systems Focus on networking Linux, SunOS, Windows NT Multiprocessor operating systems Real-time operating systems Hard versus soft real-time OS Embedded operating systems Memory, power constraints Smart card operating systems Extreme resource constraints Mobile Operating Systems Android, iOS, Android Wear
4
Review: Computer Hardware
Monitor Bus Components of a simple personal computer
5
Overview of this lecture
Process File systems System calls
6
Program vs. Process A process is a program in execution
Program is a piece of code Process has “state” (what could this state be?) There could be multiple processes all simultaneously executing the same program Coordinate accesses and sharing of resources Sharing in time – CPU cycles Sharing in space – Memory
7
Processes Process = program in execution
Address space Program (text), data, stack Registers Program counter, stack pointer, etc Processes can be created, suspended, restarted, killed (!) Process scheduler decides which process to run next among all the current processes
8
Process Creation In UNIX, there is a way for one process to “spawn” more processes A process tree Process A created two child processes, B and C Process B created three child processes, D, E, and F
9
Processes: Memory Sharing
Operating System Physical memory
10
Inter process communication (UNIX)
A pipe is like a pseudo file. Processes set up a pipe in advance. Processes read from or write to a pipe.
11
Mounting Files (UNIX) Before mounting, After mounting floppy on b,
files on floppy/CD-ROM are inaccessible After mounting floppy on b, files on floppy/CD-ROM are part of file hierarchy
12
File Permissions Example
% ls -lR .: total 2 drwxr-x--x 2 guan adm Dec 17 13:34 A drwxr guan adm Dec 17 13:34 B ./A: total 1 -rw-rw-rw- 1 guan adm Dec 17 13:34 x ./B: -r--rw-rw- 1 guan adm Dec 17 13:34 x -rw----rw- 1 trina adm Dec 17 13:45 y Show an example, man, ls, chmod Copyright © 2002 Thomas W. Doeppner. All rights reserved.
13
Setting File Permissions
#include <sys/types.h> #include <sys/stat.h> int chmod(const char *path, mode_t mode) only the owner of a file and the superuser may change its permissions nine combinable possibilities for mode (read/write/execute for user, group, and others) S_IRUSR (0400), S_IWUSR (0200), S_IXUSR (0100) S_IRGRP (040), S_IWGRP (020), S_IXGRP (010) S_IROTH (04), S_IWOTH (02), S_IXOTH (01) Symbolic mode Chmod o-x file Copyright © 2002 Thomas W. Doeppner. All rights reserved.
14
Structure of UNIX Shell User Input Kernel (OS)
15
System Calls Interface between the user and the operating system (kernel) Handle processes, files, directories, time, input/output Switch processor from user to kernel mode In User mode, some instructions are forbidden In Kernel mode, all instructions are allowed
16
Example Read from file n = read(fd, buffer, nbytes);
Change directory s = chdir(dirname); Get time s = time(&seconds);
17
System Calls For File Management
18
System Calls For Directory Management
19
System Calls For Miscellaneous Tasks
20
Quick Questions Does this belong in the OS?
Text editor Compiler Web browser Shell client Program which copies files Device driver (program which controls a hardware device)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.