0
0
Operating Systemsknowledge~10 mins

SJF (Shortest Job First) in Operating Systems - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to identify the process with the shortest burst time.

Operating Systems
shortest_process = min(processes, key=lambda p: p[1])
Drag options to blanks, or click blank then click option'
Aprocess_id
Barrival_time
Cpriority
Dburst_time
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing arrival time instead of burst time
Using priority which is unrelated to SJF
2fill in blank
medium

Complete the code to sort processes by their burst time for SJF scheduling.

Operating Systems
sorted_processes = sorted(processes, key=lambda p: p[1])
Drag options to blanks, or click blank then click option'
Aburst_time
Barrival_time
Cpriority
Dprocess_id
Attempts:
3 left
💡 Hint
Common Mistakes
Sorting by arrival time or priority instead of burst time
3fill in blank
hard

Fix the error in the condition to select the next process with the shortest burst time.

Operating Systems
if current_process.burst_time > [1].burst_time:
Drag options to blanks, or click blank then click option'
Awaiting_process
Bprevious_process
Cnext_process
Drunning_process
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing with previous or running process which is incorrect in this context
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps process IDs to their burst times for processes with burst time less than 10.

Operating Systems
{p[1]: p.burst_time for p in processes if p.burst_time [2] 10}
Drag options to blanks, or click blank then click option'
A.process_id
B>
C<
D.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' in the condition
Using incorrect attribute for process ID
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps process names in uppercase to their burst times for processes with burst time greater than 5.

Operating Systems
{p[1]: p[2] for p in processes if p.burst_time [3] 5}
Drag options to blanks, or click blank then click option'
A.name.upper()
B.burst_time
C>
D.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' in the condition
Using incorrect attributes for keys or values