1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Bài giảng nhập môn điện toán Hệ điều hành

83 6 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Hệ điều hành
Trường học Unknown
Chuyên ngành Hệ điều hành
Thể loại Bài giảng nhập môn điện toán
Định dạng
Số trang 83
Dung lượng 7,76 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

What is an operating system History of operating systems The operating system zoo Computer hardware review Operating system concepts System calls Bài giảng nhập môn điện toán Hệ điều hành Bài giảng nhập môn điện toán Hệ điều hành

Trang 1

Phần 1: Hệ điều hành

Chương 3

1 What is an operating system

2 History of operating systems

3 The operating system zoo

4 Computer hardware review

5 Operating system concepts

6 System calls

Trang 2

Tài liệu tham khảo: chương 1 của quyển

Andrew S Tanenbaum: Modern Operating Systems,

2 nd ed, Prentice Hall

http://www.prenhall.com/divisions/esm/app/author_tanenbaum/custom/mos2e/

Trang 3

Giới thiệu

• A computer system consists of

– hardware

– system programs

Trang 4

Hệ điều hành là gì?

• It is an extended machine

– Hides the messy details which must be performed

– Presents user with a virtual machine, easier to use

(by using system calls)

• It is a resource manager

– Multiplexing the resource in time: each program

gets time with the resource, e.g CPU, printer

– Multiplexing the resource in space: each program

gets space on the resource, e.g memory, disk

Trang 5

Lịch sử hệ điều hành

• First generation 1945 - 1955

– vacuum tubes, plug boards

– Inventors: Aiken (USA), Zuse (Germany)

• Second generation 1955 - 1965

– transistors

– batch systems

• Third generation 1965 – 1980

– ICs (Integrated Circuits)

– multiprogramming, spooling, time-sharing

• Fourth generation 1980 – present

– LSI (Large Scale Integration)

– Hệ điều hành cho PC

Trang 6

Lịch sử hệ điều hành

Thế hệ thứ 2

Early batch system (hệ thống xử lý bó)

– bring cards to 1401

– read cards to tape

– put tape on 7094 that does computing

Trang 7

Lịch sử hệ điều hành

Thế hệ thứ 2

Structure of a typical FMS job

(FMS: Fortran Monitor System, hệ điều hành của IBM cho mainframe 7094)

Trang 9

– DOS (Disk Operating System)

– MS-DOS (Microsoft Disk Operating System)

• 1983, IBM PC/AT (Intel 80286 CPU)

• 1985-1995, Windows on top of MS-DOS

• Pentium PC

– UNIX, Linux, Windows 2000

– X Windows system (UNIX, Linux)

Trang 10

The Operating System Zoo

• Mainframe operating systems High-end Web servers

– OS/390

• Server operating systems Web service, file service

– UNIX, Linux, Windows 2000

• Multiprocessor operating systems

• Personal computer operating systems

– Linux, Windows XP, Macintosh

• Real-time operating systems Control systems

– VxWorks, QNX

• Embedded operating systems Mobile phones

– uCLinux, PalmOS, Windows CE

• Smart card operating systems Smart cards

Trang 11

Computer Hardware Review

Các thành phần của một PC đơn giản

Monitor

Bus

Trang 12

Computer Hardware Review

Trang 13

Computer Hardware Review

Memory (1)

Typical memory hierarchy

numbers shown are rough approximations

Trang 14

Computer Hardware Review

Memory (2)

Cấu trúc của một ổ đĩa cứng

Trang 15

Computer Hardware Review

Memory (3)

Một cặp base-limit Hai cặp base-limit

Trang 16

Computer Hardware Review

Trang 17

Computer Hardware Review

Buses

Cấu trúc của một hệ thống Pentium

IDE bus SCSI bus

Trang 18

Các ý niệm chủ đạo trong hệ điều hành

• Quá trình (process)

• Deadlock

• Quản lý bộ nhớ (memory management)

• Nhập/xuất dữ liệu (input/output)

• Tập tin (file)

• An ninh dữ liệu (security)

• The shell

Trang 19

Các ý niệm chủ đạo trong hệ điều hành

Quá trình

Một cây quá trình (process tree)

– A đã tạo hai quá trình con, B và C

– B đã tạo ba quá trình con, D, E, và F

Quá trình là một chương trình đang thực thi

Trang 20

Các ý niệm chủ đạo trong hệ điều hành

Deadlocks

• Khi hai hay nhiều quá trình tương tác với nhau thì

chúng có thể lâm vào tình trạng deadlock

– Ví dụ: một máy tính với một ổ băng từ và một ổ ghi

CD Hai quá trình A và B muốn ghi lên CD từ dữ liệu

trên băng từ

Quá trình A yêu cầu và được cấp phát ổ băng từ

Quá trình B yêu cầu và được cấp phát ổ ghi CD

Quá trình A yêu cầu ổ ghi CD, bị tạm dừng

Quá trình B yêu cầu ổ băng từ, bị tạm dừng

Trang 21

Các ý niệm chủ đạo trong hệ điều hành

Trang 22

Các ý niệm chủ đạo trong hệ điều hành

Files (2)

• Before mounting (gắn),

– files on floppy are inaccessible

• After mounting floppy on b,

– files on floppy are part of file hierarchy

Trong UNIX

Floppy disk

Trang 23

Các ý niệm chủ đạo trong hệ điều hành

Files (3)

Two processes connected by a pipe

Trong UNIX

Trang 24

Các ý niệm chủ đạo trong hệ điều hành

Shell

• Ví dụ một shell: UNIX command interpreter

– Là chương trình đợi và nhận lệnh của người dùng

từ terminal, gọi system call tương ứng với lệnh

shell không phải là một phần của hệ điều hành!

Trang 25

System Calls

Process Management

Trang 26

System CallsProcess Management (3)

Processes have three segments: text, data, stack

Trong UNIX

Trang 27

System Calls

File Management

(file: tập tin)

Trang 28

System Calls

Directory Management

(directory: thư mục)

Trang 29

System CallsDirectory Management (2)

(a) File system before the mount(b) File system after the mount

Trong UNIX

Trang 30

System Calls

Miscellaneous Tasks

Trang 31

System CallsThe Windows Win32 API

Trang 32

Metric Units

The metric prefixes

Trang 33

Quá trình

Nói thêm về

Trang 34

Mô hình của quá trình

(a) Multiprogramming of four programs

(b) Conceptual model of 4 independent, sequential processes

(c) Only one program active at any instant

Mô hình: kết quả của sự trừu tượng hóa (rút trích các thông tin chính yếu),

thường được biểu diễn bằng một sơ đồ.

Trang 35

Tạo quá trình

Các biến cố chính gây ra việc tạo quá trình

1 System initialization

2 Execution of a process creation system

call by a running process

3 User request to create a new process

4 Initiation of a batch job

Trang 36

Sự chấm dứt của quá trình

Quá trình chấm dứt dưới một trong các

điều kiện sau

1 Normal exit (voluntary, tự ý)

2 Error exit (voluntary)

3 Fatal error (involuntary, không tự ý)

4 Killed by another process (involuntary)

Trang 37

Process Hierarchies

• Parent creates a child process, child processes

can create its own process

– Forms a hierarchy

– UNIX calls this a "process group"

• Windows has no concept of process hierarchy

– all processes are created equal

Trong UNIX

Trang 38

Các trạng thái của quá trình (1)

• Possible process states

Trang 39

Các trạng thái của quá trình (2)

• Lowest layer of process-structured OS

– handles interrupts, scheduling

• Above that layer are sequential processes

Trang 41

Hiện thực quá trình (2)

Skeleton of what lowest level of OS does when an

interrupt occurs

Trang 42

Định thời

Nói thêm về

Trang 43

Giới thiệu về định thời

Mục tiêu của giải thuật định thời dưới các tình huống khác nhau

(Hệ thống tương tác)

(Hệ thống thời gian thực) (Hệ thống xử lý bó)

Trang 44

Định thời trong hệ thống xử lý bó

An example of shortest job first scheduling

(a) Running four jobs in the original order

(b) Running them in shortest job first order

Đơn vị: phút

Trang 45

Định thời trong hệ thống tương tác (1)

Round Robin Scheduling (Định thời xoay vòng)

(a) list of runnable processes

(b) list of runnable processes after B uses up its time

quantum

Trang 46

Định thời trong hệ thống tương tác (2)

A scheduling algorithm with four priority classes:

- Round-robin scheduling within each class

- Run the processes of the higher priority classes first

Trang 48

– small amount of fast, expensive memory – cache

– some medium-speed, medium-price main memory

– gigabytes of slow, cheap disk storage

• Memory manager handles the memory hierarchy

Trang 49

Basic Memory Management i.e without Swapping or Paging

• Monoprogramming: three simple ways of organizing

memory with an operating system and one user process

Trang 50

Multiprogramming with Fixed Partitions

Fixed memory partitions

(a) separate input queues for each partition

Trang 51

Memory allocation changes as

– processes come into memory: process A is swapped in from disk,

Fig (g)

– leave memory: process A is swapped out to disk, Fig (d)

Shaded regions are unused memory

Trang 52

Bộ nhớ ảo

Phân trang (Paging) (1)

The position and function of the MMU

(Memory Management Unit)

Bộ nhớ ảo: programs may be only partially in main memory

Trang 54

Bảng các trang (Page table)

Trang 55

Phân đoạn bộ nhớ (1)

• One-dimensional address space with growing tables

Tables during a compilation

Trang 56

Phân đoạn bộ nhớ (2)

Trang 57

Phân đoạn bộ nhớ (3)

Trang 58

Implementation of Segmentation

• Paging the segments: the virtual memory on

the Intel Pentium

Trang 59

Hệ thống file

Nói thêm về

• Files

• Directories

• File system implementation

• Example file systems

Trang 60

Long-term Information Storage

Yêu cầu đặt ra cho việc lưu trữ thông tin lâu dài

• Must be possible to store large amounts of data

• Information stored must survive the termination of

the process using it

• Multiple processes must be able to access the

information concurrently

Lời giải: lưu thông tin trên đĩa cứng (hay CD-ROM,…)

dưới dạng các tập tin (file).

Trang 61

File, dưới cái nhìn của người sử dụng

Trang 62

File Naming

Typical file extensions

Trang 63

File Structure

Three kinds of files

(a) byte sequence

(b) record sequence

Trang 64

File Types

(a) An executable file (b) An archive

Trang 65

Truy cập file (File Access)

• Sequential access

– read all bytes/records from the beginning

– cannot jump around, could rewind or back up

– convenient when medium was mag tape

• Random access

– bytes/records read in any order

– essential for data base systems

– read can be …

• move file marker (seek), then read or …

• read and then move file marker

Trang 66

File Attributes

Possible file attributes

Trang 67

Các thao tác lên tập tin

Trang 68

An Example Program Using File System Calls (1/2)

Trang 69

An Example Program Using File System Calls (2/2)

Trang 70

Directories (Folders)

Single-Level Directory Systems

• Example of a single-level directory system that

– contains 4 files

– owned by 3 different people, A, B, and C

• Được sử dụng trên máy CDC 6600

Trang 71

Two-level Directory Systems

Letters indicate owners of the directories and files

Trang 72

Hierarchical Directory Systems

A hierarchical directory system

Trang 73

A UNIX directory tree

Path names cho file trong

một directory tree

/usr/lib/dict

Trang 74

Các thao tác lên thư mục

Trang 75

File và directory dưới cái nhìn của người hiện

thực

• Layout của file system

• Hiện thực file

• Hiện thực directory

Trang 76

File System Implementation

A possible file system layout

Trang 77

Implementing Files (1)

(a) Contiguous allocation of disk space for 7 files

(b) State of the disk after files D and E have been removed

Trang 78

Implementing Files (2)

An example i-node

Trang 79

Implementing Directories

(a) A simple directory

- fixed size entries

- disk addresses and attributes in directory entry

(b) Directory in which each entry just refers to an i-node

Trang 80

The MS-DOS File System

The MS-DOS directory entry

Trang 81

The UNIX V7 File System (1)

A UNIX V7 directory entry

Trang 82

The UNIX V7 File System (2)

A UNIX i-node

Trang 83

The UNIX V7 File System (3)

The steps in looking up /usr/ast/mbox

Ngày đăng: 25/08/2023, 14:24

HÌNH ẢNH LIÊN QUAN

Bảng các trang (Page table) - Bài giảng nhập môn điện toán Hệ điều hành
Bảng c ác trang (Page table) (Trang 54)

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w