Principles of Structure of Operating Systems 046209 - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

Principles of Structure of Operating Systems 046209

Description:

... System (English-Hebrew): ????? ?????, ... give me all records with 'Name=Yossi' ... use data in buf */ lseek(fd, offset,...) write(fd, buf, len) ????: fd = open ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 40
Provided by: drrake
Category:

less

Transcript and Presenter's Notes

Title: Principles of Structure of Operating Systems 046209


1
Principles of Structure of Operating
Systems??????? ???? ?????? ?????046209
  • ???? 10
  • ???? paging (thrashing)
  • ????? ??????? ?????

???? ????
2
???? ?????/???
  • Silbershatz ????'
  • thrashing
  • ?????? 5, ??? 9.7
  • ?????? 6, ??? 10.6
  • ???? ????? ?????
  • ?????? 5, ??? 10
  • ?????? 6, ??? 11

3
?????? demand paging
  • ??????? demand paging ??????? ???? ?????? ???????
    ???????
  • ?? ????? ?????? ?? ???? ???????? ??????? (????? ?
    ready queue) degree of multiprogramming
  • ???? ?????? ???? ? multiprogramming ?? ??????
    ??????

4
?????? ????? demand paging
5
????? Thrashing
  • ????? ????? ???? thrashing ?? ??? ???? ???? ???
    ?????? (context switch, paging) ???? ??????
    (???? ???????)
  • ????? ???? ???? thrashing ?? ??? ???? ??? ?? ????
    ?- paging (C.S.) ???? ?????? (????)
  • ??? ?? ?????
  • ???? ????? ? working set

6
"????? ?????" Working Set
  • ???? ???? ????? ?????? ?-thrashing
  • ?? locality ??????? ?????? ???
  • ????? ???? ?????? ?????? ????? ????? ??????
  • ???? ??????? ????? ???? (?????? ??????) ??????
    ????? working set
  • ??? ?????? working set ???? ????? ??? ??? ?, ???
  • ???? ?-i ???? ????? ???? t,t-? WSi(t,?)

7
The Working Set Model Denning68
  • A processs working set is the set of pages in
    the processs last ? page references

8
Working Set Model
  • ????? - locality of reference. ??????? ??????,
    ???? ??? ????? ?- locality ?- locality, ????
    locality ??? ????? ???? (???? ????? ?????
    ??????)
  • ?? ?"? ????? ????? ???? ?? ????? ?- locality
    ?????? ?????? ???????, ???? ?????? ????? ????
    ????????
  • working set ????? ?- locality ?"? ????? ?????
    ???????? ?- D page references ????????
  • ????? (D 10)
  • 261577775162341234443431243444334344

WS1 3,4
WS21,2,5,6,7
t1
t2
9
?????Working Set
  • ????? ?? ????? ?????? ???? ?????? ?
  • ? ??? ??? ??? ????
  • ? ???? ???? ??? ?????? ?-WS
  • ? ? ????????? ????? ??? ???? ??????

10
????? ?-Working Set
  • ?? ????? ?????? ??? ????? i ?? WSi ?-WS ??????
    ???, ????? ?????
  • ?????? ?????? WSi ?????? ??? ????? i ?????
    ?-ready queue ?? waiting
  • ??-i ???? ?-WS ????, ????? ?? ?? ????? ??? ?-WS
    ????, ?????? (prefetching) ?? ?? ????? ?? ?-WS
    ????
  • ???????, ??? ??? ??????
  • LRU ???? ????? ??? ?-WS (????? ??-??)
  • ?? ???? ? thrashing?

11
Working Set ? Thrashing
  • ??? ????? thrashing, ???? ? WSi ?????? ??????.
  • ?? ??? ????? frames ?????? ??? ????? ?? WS ??
    ????????, ?????? ???? thrashing
  • ??????
  • swapping ????? ??????? (????? ?? ????? ????
    ?????, ?????? ???? ?-swapped)

12
UNIX process states
running user
schedule
sys. call interrupt
return
zombie
ready user
interrupt
running kernel
terminated
preempt
wait for event
schedule
ready kernel
event done
blocked
created
Swap out
Swap in
Swap out
ready swapped
blocked swapped
event done
13
Long-Term Scheduling
  • Controls multiprogramming level
  • Decision of which processes to swap out/in is
    based on
  • CPU usage (I/O bound vs. CPU bound)
  • Page fault rate
  • Priority
  • Size
  • Blocked vs. running

14
????????
  • 1960, Atlas, University of Manchester
  • demand paging
  • 1961-1973 MIT, CTSS
  • time-sharing ?? swapping
  • 1965 Dennis ????? ?? segmentation
  • 1965 ?????? ???? MULTICS, MIT GE Bell
  • ??? ? 1972, ????? ? segmentation paging
  • ???? System/360 , IBM
  • 1964 load-time binding (fixed/variable
    partitions)
  • 1972 ???? ??????????? ?? IBM370, virtual memory
    (segmentation paging), ?"? MVS

15
???????? ????
  • 1978 Intel 8086
  • segmentation
  • 1986, Intel 386 ?????
  • segmentation paging

16
?????? ????? ??????? ?????
17
What Babylon Says
  • File System (English-Hebrew)
  • ????? ?????, ????? ??????? ??? ???? ??????
  • File System (English-English)
  • System which regulates the naming of files

18
?????? ?????
  • ????????? ?????? ?????? ?????
  • ????? ???????? ?? secondary storage
  • ?????????? ???????
  • ????
  • ????? directory
  • ??? ????, ???? ???? ???????
  • ?? ?????????? ????? (??????? ?????)
  • ????? (????? ???)

19
Memory Hierarchy
20
Main Memory vs. Secondary Storage
  • Small (MB/GB)
  • Expensive
  • Fast (10-6/10-7 sec)
  • Volatile
  • Directly accessible by CPU
  • Interface (virtual) memory address
  • Large (GB/TB)
  • Cheap
  • Slow (10-2/10-3 sec)
  • Persistent
  • Cannot be directly accessed by CPU
  • Data should be first brought into the main memory

21
Some Numbers
  • 1GB230 109 Bytes
  • 1TB240 1012 (terabyte)
  • 1PB250 1015 (petabyte)
  • 1EB260 1018 (exabyte)
  • 232 4 x 109 Genome base pairs
  • 264 16 x 1018 Brain electrons
  • 2256 65,536 x 1072 Particles in Universe

22
????? ?????? ?????
  • ????? ?????? ????? ??????? ?????? ?/?? ??????
    ?????
  • ?????? ???????? ?- data ???? ???? ????? ???????
    ?????????
  • ????? ???? ??? ??????? ?????
  • ??????
  • ?????? ?? ???? (non-volatile)
  • ???? ????? ???? ???
  • ???? ?? ????? ?????? - ???? ????
  • ???? ???????? ?? ???? ?????
  • ???? ?????
  • ???? ????? ?????
  • ????? ????? ????? ?????? ??????
  • ???? ?????? ?????

23
File ????
  • File is a named persistent collection of data
  • ????? ???? ?????, ??? ?? ??, ???? non-volatile
  • ????? ???? ??? ????? ???? ???? ???? ??????? ?????
    ????
  • ????? ??? ???? ???? ????? ????? ???? (??
    ??-?????)
  • Unstructured, sequential (UNIX)
  • Data is accessed by specifying the offset from
    start
  • Collection of records (database systems)
  • Supports associative access
  • give me all records with NameYossi
  • Attributes owner, permissions, modification
    time, size, etc

24
?????
  • ???? ???? ?????? ????? (ADT)
  • ?????? ???? ???? ??? ????? ??? ????
  • ????? ??
  • ?? ????? ?"? ??????
  • ????/????/data
  • ?????? attributes (???? ?"?)
  • ?????? operations

25
?????? ????? (attributes)
  • ??? ????? - text, binary, archive ???'
  • ????? ?? ????? ( device) ?????? ?- data ????
    (??????)
  • ???? ( ???????)
  • Owner
  • ?????? (permissions) ????? ???? - ??? ????
    ?????, ?????, ?????
  • ???? ?????, ????, ????? ?????
  • ???? ???? ????? ???? meta-data
  • ???? ?? ?????? ???? ?? ??? ?????

26
?????? ?? ????? (??"? ?????? ?????)
  • ????? -(create ) ??? ???? ???' ????? ???? ??
    ?????? ?????
  • ????? (delete/unlink )
  • ????? (open ) - ????? attributes ????? ????
    ?????
  • ????? (close ) ???? ???? ?????? ??????
    ????????
  • ????? (read ) - ??"? ?????? ????? ????? ?"?
    ?????. ?? ????? ???? ?????? ?- buffer ???????
  • ????? (write ) - ?? ?????? ???? ?????, ?????
    ???. ????, ????? ????? ???? ?? ???? ??? ?????
    ????
  • ??? ????? ?????? (seek) - ??????/????? ???????
    (random access)
  • get attributes ????? ???????? ??????? (stat)
  • ?????? ?"? ?????? ????? (???? make ????? ?-stat
    ???? ???? ????? ?????)
  • set attributes (???? chmod) 
  • rename (move)

27
???? ?????
  • ????? ???? ?????? ????? ?????
  • ????? ??? ????? ????? ?????? (????, ?????)
  • ??? ???? ?? ?? (?????? ?? ?? ???? ?????)
  • ????? ??"? ?"? ?? ?-????? ???????? ( extension)
  • dos - ???? ?? ?? com, exe, bat
  • mac - ??? ???? ????? ????????? ?????? ???? -
    ????? ?? ????? ?????? ?? ????????? ??????? (??
    ?????? ?)
  • Unix - ?????? ??? ????? ?????? ????
  • Regular (???? ?? ????)
  • FIFO (named pipe)
  • directory
  • Symbolic link
  • ??????????? ?? ???? regular ?????? ??"? ?"?
    ??????
  • Magic Number ???? ?? ??? ????? ?-Unix ??????
    "?????" ?? "???"

28
Memory Mapped Files
  • A file (or a portion thereof) is mapped into a
    contiguous region of the process virtual memory
  • ????? ??? ???? ???? ?????? ?????????? ?????
    ???????
  • UNIX mmap system call
  • Mapping operation is very efficient
  • just marking
  • ?????? ???? ?"? ????? ???? ?-page table ???????
    ????? ????? ?? ????? ????
  • The access to file is governed by the virtual
    memory subsystem

29
Memory Mapping
  • ????? ????? ????? ??????? (mmap, munmap)
  • ????? ?????? ????? ??? ???? ???????.
  • ????? - ????? ??????? ??? ??????? ????? page
    fault ?????? ???? ?????? ???????

???? fd open(...) lseek(fd, offset,..) read(fd,
buf, len) / use data in buf / lseek(fd,
offset,) write(fd, buf, len)
???? fd open(...) address mmap((caddr_t) 0,
len, (PROT_READ PROT_WRITE), MAP_PRIVATE, fd,
offset) / use data at address /
30
Memory Mapping ??? ????
  • ???????
  • ??? ???? ??????? I/O ?????? - ??? ?? ??????
  • ?????? ?? segmentation ???? ????? ???? ?-
    segment
  • ????? ?-buffers (???? buffering ?? ????? ??"?)
  • ????? ??????? ??? buffer cache ??????? ????????
  • ???? ????? ????? swap ?????
  • ???????
  • ????? ????? ??????? ?? ???? (??????? ??? ???
    "??????" ??????)
  • ?? ???? ????? ????? ?????? (???? ????? ???)
  • ??? ????? ?? ?????? ????? (????? ???? ?????)
  • ???? ?????? ?? ????? ????? ??????

31
?????? Directories
  • ???? ????? ?????? ????? ?????? ???
  • ???? ???? ?? ?????
  • ?????
  • single-level
  • ) two level (per user
  • tree (dos)
  • directed acyclic-graph
  • general graph
  •  
  • ??? ???? ?? ???? foo ???? /usr/moses/foo
  • ????? ??? ????? ????? ( path relative) ?? ?????
    ????????? (absolute path)

32
link/unlink
  • Unix ???? ?- links ??????? ???? ???
  • link - ????? ????? ?- directory ???? ???? ????
    (????? link count)
  • int link(const char existing, const char new)
  • unlink - ???? ????? ?- directory
  • ?? reference count 0, ??? ?? ?????
  • echo foo gt foo
  • ln foo bar/bar
  • ls l foo
  • -rw-r--r-- 2 user users 4 Jan 8
    1232 foo
  • rm foo
  • ls -l bar/bar
  • -rw-r--r-- 1 user users 4 Jan 8
    1232 bar/bar
  • ??? ???????/??????? links ?
  • ??? ???? ???? mv ?

33
symbolic link
  • ???? ????? ????? ????? ?? ???? ???
  • int symlink(const char existing, const char
    new)

echo foo gt foo ln -s foo bar/bar ls l
foo -rw-r--r-- 1 user users 4 Jan
8 1232 foo rm foo ls -l bar/bar -rw-r--r--
1 user users 4 Jan 8 1232 bar/bar
-gt foo
34
??????
  • mkdir- ???? ????? ???? (??? ?- dot,dotdot)
  • rmdir ???? ????? (????? ?? ?? ????)
  • opendir,readdir,closedir (?? system calls) ??????
    directories
  •  
  • chdir
  • mount/umount - attach file system
  • chroot

main() DIR dirp struct dirent direntp dirp
opendir( "." ) while ( (direntp readdir(
dirp )) ! NULL ) (void)printf( "s\n",
direntp-gtd_name ) (void)closedir( dirp ) return
(0)
35
Access Control
  • ????? ?????? ????? ??????? ????? ???????
  • ???? ????? ?????
  • ?? ?? ?????? ????
  • ??? ????/????? ???? ????? ??? ???? ???? ??????
    ????? ????
  • ?????, ?????, ????, ?????, ????? ??????
  • ????? Access Control List (ACL) ??? ????? ??
    ??????? ????? ???? ??????? ??? ??? ???

36
????? ACL
  • ?????? ????? ????? ???? ????? ??? ????? ????
  • ?? ????????? ??????? (2000)
  • ?? ????? ????? ?????? ??? ftp
  • ?? ???? ?????? ????? ????. ???? ????? ??????
  • ?????? ? Unix ?? ????? ???? ????????
  • user, group, universe
  • ??????
  • ?? ?????? ???????? ???? ????, ???? Solaris
  • -rw-r--r-- idit os . file1.txt
  • ? ???? ??? ACL ????
  • ????? ?"? setfacl / getfacl
  • ????? ????? ??? ???? ?????? .. ??????

37
Consistency Semantics
  • ???? ?????? ?? ?????? ??? ???? ??????? ???????
    ???? ??????.
  • ??? ???????? ???? ???? ?"? ??????? ?????? ?????
    ?"? ??' ???????
  • ????? session ????? ?? ?????? read ?- write
    ???????? ??? ????? open ?????? - close.

38
Unix Consistency Semantics
  • ?? ????? ????? ????? ?????? ??? ????????
    ???????? ???? ???? ????
  • ???? ???? ??????? ?????? ????? ????? (?????
    file pointer ??? ???????, ???? ?-fork)
  • ????? ?"? image (????) ???? ??? ???? - ?? ?????
    ?? read ?- write
  • ????? ???????? ?? ??????? ??????? ????? ????????
    ????? ?????? ????
  • ????, NFS ????? ????? ????? ??? ??????
  • mount ?? ?????? ??????? ?????
  • ???????? ? NFS ?? ??????!
  • ??????? ?????? ???? ??? ?? ????? (???? ?? 30
    ?????)

39
Session Semantics
  • ????? ????? ?? ????? ?????? ??? ????????
    ???????? ???? ???? ????.
  • ???????? ?? ?????, ???????? ??????? ????? ??? ?-
    sessions ??????? ????? ????.
  • ???? ?????? ??' images ????? ??? ??-?????
  • ????? ???? ?????? AFS
  • ????? ????? ??????
  • ?????? ??? LAN ? WAN
  • caching ?? ?? ???? ???? ??? ?????
Write a Comment
User Comments (0)
About PowerShow.com