Introduction to AOS course

48
Van Hoang Nguyen Mail: [email protected] Department of Computer Science FITA HUA Advanced Operating System Course ---------------------------------- Fall 2012 Dept. of Computer Science FITA HUA

description

Review basic concepts in OS and introduce AOS course

Transcript of Introduction to AOS course

Page 1: Introduction to AOS course

Van Hoang Nguyen

Mail: [email protected]

Department of Computer Science – FITA – HUA

Advanced Operating System Course ---------------------------------- Fall 2012

Dept. of Computer Science – FITA – HUA

Page 2: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen http://en.wikipedia.org/wiki/EDVAC

Page 3: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 4: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 5: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 6: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 7: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Registers

Stack

R

S

R

S

R

S

Page 8: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 9: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

batch, interactive, real-time

Page 10: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

throughput, turnaround time, CPU

utilization

response time, proportionality

meeting deadlines, predictability

Page 11: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

› Shortest Remaining Time Next

Page 12: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

› Shortest Process Next

› Guaranteed Scheduling

› Lottery

› Fair share

Page 13: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 14: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Strict alternation

Peterson’s solution

TSL/XCHG

Semaphores

Mutexes

› Barrier

Page 15: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

memory hierarchy

Page 16: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Base and Limit Register

Swap

Virtual Memory

Page 17: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

long-term information storage

Page 18: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 19: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 20: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

File A File B File C

File

block

0

File

block

1

File

block

2

File

block

3

Page 21: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

File A

0 1 2 3 4 5 6 7

6 7 -1 2

Page 22: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

File’s Name Attributes

File’s Name Attributes

File’s Name Attributes

File’s Name Attributes

File’s Name

File’s Name

File’s Name

File’s Name

Page 23: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 24: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 25: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 26: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 27: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 28: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen Sourced by: Machine learning overview – Ho T.B

Page 29: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

(diversity of mobile devices)

Page 30: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 31: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Lecture Reference

Introduction [3] Chapter 1 - 13

Parallel and Distributed [1]. Chapter 8

Real-Time [1]. Chapter 7 and [2]

WebOS

Kernel Architecture

Big Storage

Protection and Security [1]. Chapter 9

Page 32: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 33: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Regular attention 10%

Mid 30%

Final 60%

Total 100%

Page 34: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 35: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 36: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 37: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

while (turn!=0) /*loop*/;

critical_region();

turn=1;

noncritical_region();

while (turn!=1) /*loop*/;

critical_region();

turn=0;

noncritical_region();

Page 38: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

void enter_region(int process)

{

int other;

other = 1-process;

interested[process]=1;

turn=process;

while (turn==process

&& interested[other]==1);

}

void leave_region(int process)

{

interested[process]=0;

}

Page 39: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

enter_region:

TSL REGISTER,LOCK

CMP REGISTER,#0

JNE enter_region

RET

leave_region

MOVE LOCK,#0

RET

enter_region:

MOVE REGISTER,#1

XCHG REGISTER,LOCK

CMP REGISTER,#0

JNE enter_region

RET

leave_region

MOVE LOCK,#0

RET

Page 40: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

void producer(){

int item;

while(true){

item=produce_item();

down(&empty);

down(&mutex);

insert_item(item);

up(&mutex);

up(&full);

}

}

void consumer(){

int item;

while(true){

item=produce_item();

down(&full);

down(&mutex);

item=remove_item();

up(&mutex);

up(&empty);

consume_item(item);

}

}

Page 41: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

mutex_lock:

TSL REGISTER,MUTEX

CMP REGISTER,#0

JZE ok

CALL thread_yield

JMP mutex_lock

ok: RET

mutex_unlock:

MOVE MUTEX,#0

RET

Page 42: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 43: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page 44: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

a simplest version of dynamic relocation

Page 45: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

not enough to hold all process in physical memory

OS

A

B

C

OS

B

C

OS

D

B

C

OS

D

C

OS

D

C

A

Page 46: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

==> some issues › Fixed size while data segment can grow

› allocate an extra memory

› arrange stack and heap segment

› Big process can not run

› Fragmentation problem

› External Fragmentation

› Internal Fragmentation

› memory compact ==> waste CPU time OS

Code

Data

Stack

Room for

grow

Page 47: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

==> some issues › How to manage free memory

› bitmaps: unit size, difficult to allocate

› free lists

› How to allocate

› first fit

› next fit

› best fit

› worst fit

› quick fit

Page 48: Introduction to AOS course

Advanced Operating System – Fall 2012

Van Hoang Nguyen

Page

Page

frame

PageTable