Operating System Chapter 3: Interrupts and Processor Scheduling

1. Interruption steps: ① Identify the interrupt source ② Save the scene ③ Lead to the interrupt handler

2. Processor scheduling algorithm:

①First come first served algorithm (FCFS)

Turnaround time = Completion time – Arrival time

Turnaround time with rights = turnaround time/service time

process

Time of arrival

service hours

Starting time

Complete time

Turnaround time

Rights turnaround time

A

0

4

0

4

4

1

B

1

5

4

9

8

1.6

C

2

2

9

11

9

4.5

D

3

4

11

15

12

3

Average turnaround time = 8.25

Average weighted turnaround time = 2.525

Draw the processing timeline as follows:

② Shortest job first algorithm (SJF)

process

Time of arrival

service hours

A

0

3

B

0

5

C

0

3

D

0

4

E

8

3

Ⅰ. Non-preemptive (jobs with short service time first)

Ⅱ. Preemptive type

a.Based on the shortest service time

b.Based on the shortest remaining service time

③Highest response ratio priority algorithm (HRN)

Priority=1+waiting time/service time

process

Time of arrival

service hours

9:40 priority during scheduling

Priority during scheduling at 10:40

J1

8:00

2h

1+\frac{5}{6}

1+\frac{4}{3}

J2

8:30

1h

1+\frac{7}{6}

J3

9:30

0.25h

1+\frac{2}{3}

1+\frac{14}{3}

Processing starts at 9:40, and the scheduling order of the three processes is J2, J3, and J1.

④Highest priority number first algorithm

process

Time of arrival

service hours

priority

A

0

2

4

B

0

4

2

C

0

7

1

D

0

2

3

⑤Cycle rotation algorithm (time slice rotation)

Waiting queue: original existing process + newly added process + previous unfinished process

process

Time of arrival

operation hours

P1

0

12

P2

0

4

P3

0

7

P4

0

3

Assuming that the time slice length is q=2, the scheduling sequence is as follows:

Guess you like

Origin blog.csdn.net/qq_74140417/article/details/135023487