Back to 课程

Computer-science_A-level_Cie

0% Complete
0/0 Steps
  1. computers-and-components
    6 主题
  2. logic-gates-and-logic-circuits
    2 主题
  3. central-processing-unit-cpu-architecture
    6 主题
  4. assembly-language-
    4 主题
  5. bit-manipulation
    1 主题
  6. operating-systems
    3 主题
  7. language-translators
    2 主题
  8. data-security
    3 主题
  9. data-integrity
    1 主题
  10. ethics-and-ownership
    3 主题
  11. database-concepts
    3 主题
  12. database-management-systems-dbms-
    1 主题
  13. data-definition-language-ddl-and-data-manipulation-language-dml
    1 主题
  14. computational-thinking-skills
    1 主题
  15. algorithms
    14 主题
  16. data-types-and-records
    2 主题
  17. arrays
    2 主题
  18. files
    1 主题
  19. introduction-to-abstract-data-types-adt
    1 主题
  20. programming-basics
    1 主题
  21. constructs
    2 主题
  22. structured-programming
    1 主题
  23. program-development-life-cycle
    2 主题
  24. program-design-
    2 主题
  25. program-testing-and-maintenance
    3 主题
  26. user-defined-data-types
    1 主题
  27. file-organisation-and-access-
    3 主题
  28. floating-point-numbers-representation-and-manipulation
    3 主题
  29. protocols
    2 主题
  30. circuit-switching-packet-switching
    1 主题
  31. processors-parallel-processing-and-virtual-machines
    5 主题
  32. boolean-algebra-and-logic-circuits
    4 主题
  33. purposes-of-an-operating-system-os
    3 主题
  34. translation-software
    3 主题
  35. encryption-encryption-protocols-and-digital-certificates
    3 主题
  36. artificial-intelligence-ai
    4 主题
  37. recursion
    1 主题
  38. programming-paradigms
    4 主题
  39. object-oriented-programming
    7 主题
  40. file-processing-and-exception-handling
    2 主题
  41. data-representation
    5 主题
  42. multimedia
    3 主题
  43. compression
    2 主题
  44. networks-and-the-internet
    11 主题
课 Progress
0% Complete

Multitasking & process states

What is multitasking?

  • Multitasking is the ability of the operating system to manage system resources (such as memory and the CPU) in a way that gives the user the impression that multiple programs are running at the same time

  • In reality, the CPU can only execute one instruction at a time

  • It can process billions of instructions per second, and can switch between tasks so quickly that it gives the illusion of programs running simultaneously

  • The OS splits tasks and allocates system resources based on a priority

What is a process?

  • A process is a program in execution

  • This includes:

    • The program code

    • Current data

    • Register values

    • Memory space

  • Each running application is treated as a separate process by the OS

  • A process does not always run continuously

  • It changes state depending on what it’s doing and whether it has access to the CPU or is waiting for something

Process states

State

Description

Running

The process is actively being executed by the CPU

Ready

The process is prepared to run but is waiting for the CPU to be available

Blocked

The process is waiting for an event or resource, such as I/O completion

Scheduling routines

What is scheduling? 

  • Deciding which tasks to process, for how long, and in what order is achieved through scheduling algorithms

  • A CPU is responsible for processing tasks as fast as possible

  • Different algorithms are used to prioritise and process tasks that need CPU time

  • The algorithms have different uses, benefits and drawbacks

Scheduling categories

  • Pre-emptive: allocates the CPU for time-limited slots

    • Allocates the CPU for a specific time quantum to a process

    • Allows interruption of processes currently being handled

    • It can result in low-priority processes being neglected if high-priority processes arrive frequently

    • Example algorithms include Round Robin and Shortest Remaining Time First 

  • Non-pre-emptive: allocates the CPU to tasks for unlimited time slots

    • Once the CPU is allocated to a process, the process holds it until it completes its burst time or switches to a ‘waiting’ state

    • A process cannot be interrupted unless it completes or its burst time is reached

    • If a process with a long burst time is running, shorter processes will be neglected

    • Example algorithms include First Come First Serve and Shortest Job First

Scheduling algorithms

Round robin (RR)

  • RR is a pre-emptive scheduling algorithm

  • Equally distributing processor time amongst all processes

  • Each process is given a time quantum to execute

  • Processes that are ready to be worked on get queued

  • If a process hasn’t been completed by the end of its time quantum, it will be moved to the back of the queue

Round robin scheduling algorithm

Round robin scheduling algorithm

First-Come-First-Served (FCFS)

  • FCFS is non-pre-emptive, prioritising processes that arrive at the queue first

  • The process currently being worked on will block all other processes until it is complete

  • All new tasks join the back of the queue

First-Come-First-Served scheduling algorithm

First-Come-First-Served scheduling algorithm

Multi-Level Feedback Queue (MLFQ)

  • MLFQ is a pre-emptive priority algorithm where shorter and more critical tasks are processed first

  • Multiple queues are used so that tasks of equal size are grouped together

  • All processes will join the highest priority queue but will trickle down to lower priority queues if they exceed the time quantum

Multi-Level Feedback Queue scheduling algorithm

Multi-Level Feedback Queue scheduling algorithm

Shortest Job First (SJF)

  • SJF is non-pre-emptive, where all processes are continuously sorted by burst time from shortest to longest

  • When new processes arrive on the queue, they are prioritised based on their burst time in the next cycle

  • Shorter jobs are placed at the front of the priority queue

  • Longer jobs have lower priority, so they are placed at the back

Shortest job first scheduling algorithm

Shortest job first scheduling algorithm

Shortest Remaining Time First (SRTF)

  • SRTF is a pre-emptive version of SJF, where processes with the shortest remaining time are higher priority

  • Time quantum is set, and if a task doesn’t complete in time, it will be re-queued for further processing

  • Before the next cycle starts, all processes are inspected and ordered by the shortest remaining time to complete

Shortest remaining time first scheduling algorithm part 1
<img alt=”Shortest remaining time first scheduling algorithm part 2″ class=”ContentBlock_figure__vJw2q” data-nimg=”1″ decoding=”async” height=”508″ loading=”lazy” sizes=”(max-width: 320px) 320w, (max-width: 640px) 640w, (max-width: 960px) 960w, (max-width: 1280px) 1280w, 1920w” src=”https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=3840/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png” srcset=”https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=16/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 16w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=32/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 32w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=48/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 48w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=64/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 64w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=96/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 96w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=128/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 128w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=256/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 256w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=384/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 384w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=640/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 640w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=750/https://cdn.savemyexams.com/uploads/2023/08/VTVvIYKO_scheduling-algorithm-shortest-time-remaining-2-alevel.png 750w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=828/https://cdn.savemyexams.co

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注