COMPUTER OPERATING SYSTEM
(COS)
GROUP 8 PRESENTATION
GROUP MEMBERS
• CLEMENT CHULU
• FLAVIOUR CHIPAMBA
• SAMUEL SIANAMATE
• BLESSINGTON MUSONDA
• HAPPY NG’AMBI
PROCESS SCHEDULING
• Proceess scheduling is an Operating System(O.S) task that schedules processes of different states like ready, waiting and
running
• It allows O.S to allocate a time interval of CPU execution for each process
• It is very important because it keeps the CPU busy all the time
PROCESS SCHEDULING QUEUES
• A queue is simply a collection of processes n storage that are waiting to be brought into memory to run a program
• Therefore, PSQ help the user to maintain a distinct queue for each and every process States and Printed CircuitBoards (PCBs)
• This is done in such a waythat all processes of the same execution state are placed in the same queue
1. Job queue: keeps or stores all the processesin the system
2. Ready queue: keeps a set of all processesresiding in main memory which are ready and waitingto execute
3. Device queue: constitutes of processeswhich are blocked due to unavailability of I/O device
OVERVIEW OF PROCESS SCHEDULING
TWO STATE PROCESS MODEL
1. Running state: In the O.S, whenever a new process is built, it is entered into the system which should be running
2. Not Running state: Processes that are not running are kept in a queue, which is waiting for their turn to execute
SCHEDULING OBJECTIVES
• Maximize the number of interactive users within acceptable response times
• Achieve a balance between response and utilization
• Avoid definite postponement and enforce priorities
• It also should give reference to the processes holding the key resources
TYPES OF PROCESS SCHEDULRS
• A scheduler is a type of system software that allows the user to handle process scheduling
• There are mainly three types of schedulers:
1. LONG TERM SCHEDULER- This is also known as the job scheduler. It regulates the program and select process from the queue and leads them into memory for execution
• It’s main is to offer a balanced mix of jobs like processor, I/O jobs, that allow managing multiprogramming
2. MEDIUM TERM SCHEDULER- It’s an important part of swapping, for it enables the user to handle the swapped out-processes
• In this scheduler, a running process can become suspended. Which makes I/O request.
• A suspended process can’t make progress toward completion. In order to remove the process from memory and make space for other processes. The suspended process should be moved to secondary storage
3. SHORT TERM SCHEDULER-This is also known as CPU scheduler
• Its main goal is to boost the system performance according to set criteria
• This helps the user to select from a group of processes that are ready to execute and allocates CPUto one of them
DIFFERENCE BETWEEN SCHEDULRS
LONG TERM SHORT TERM MIDDLE TERM
• It’s also known as job scheduler • Also known as a CPU scheduler • Is also called swapping scheduler
• It’s either absent or minimal in a time sharing system • It is significant in the time sharing order • It’s an element of Time-sharing systems
• Speed is less compared to the short term scheduler • Speed is the fastest compared to the long term and
medium term scheduler
• It offers medium speed
• Allows user to select process from the loads and pool
back into the memory
• It only selects processes that is in a ready state of the
execution
• It helps users to send process back to memory
• Offers full control • Offers less control • Reduce the level of multiprogramming
PSEUDO CODE CONCEPTS
• Pseudocode is a simple wayof writing programming code in English
• It is not actual programming language
• It is offen used in all various fields of programming, wether it be app development, data science, or web development
• Pseudocode is a technique used to describe the distinctsteps of an algorithm in a manner that is easy to understand for anyone
with basic programming knowledge
• It uses short terms or simple English language syntaxesto writecode for programs before it is actually converted into a specific
programming language
MAIN CONSTRUCTS OF PSEUDO CODE
• The core of pseudocode is the ability to represent 6 programming constructs.( Always written in upper case): SEQUENCE, CASE, WHILE, REPEAT-UNTIL, FOR
and IF-THEN-ELSE
• These constructs also called keywords are used to describe the control flow of the algorithm
• SEQUENCE: Represents linear tasks sequentially performed one after the other
• WHILE: A loop with a condition at it’s beginning
• REPEAT-UNTIL: A loop with a condition at the bottom
• FOR: Another way of looping
• IF-THEN-ELSE: A condition statement changing the flow of the algorithm
• CASE: The generalizationform of IF-THEN-ELSE
RULES FOR PSEUDOCODE
• Example;
• TASK LIST:
Read name, hourlyrate, hoursworked, deduction rate,
Perform calculations
grossPay=hourly Rate*hourly Worked
deduuction=gross pay*deduction Rate
netPay=grossPay – deduction
Write name, grossdeduction, netpay
• PSEUDOCODE
READname, hourlyRate,hours worked,deductionRate
grossPay=hourlyRate*hourlyWorked
deduction=grossPay*deductionRate
netPay= grossPay– deduction
WRITE name, grossPay, deduction,netPay
RULES FOR PSEUDOCODE
1. WRITE ONLY 1 STATEMENT PER LINE
• Each statement should express just one action for the computer
2. CAPITALIZE INITIAL KEY WORDS
• In the above example, READ and WRITE are in caps
• There are just a few keywords used
• READ, WRITE, IF, ELSE,END IF, WHILE, END WHILE, REPEAT-UNTIL
3. INDENT TO SHOW HIERARCHY
• A particular indentation pattern in each of the design structure is used:
• SEQUENCE – Keeps the statements that are stacked in sequence all starting in the same column
• SELECTION – Indent the statements that fall inside the selection structure, but not the key words that form the selection
• LOOPING – Indent the statements that fall inside the loop,but not keywords that form the loop
- In the above example, employeeswhose grossPayisless than 100 do nothave anydeduction.E.g:
RULES FOR PSEUDOCODE
4 . END MULTILINE STRUCTURES
• See how the IF/ELSE/END IF is constructedabove
• The END IF or ( END Whatever) always is in line with the IF or (whatever starts thestructure).
5. KEEP STATEMENTS LANGUAGE INDEPENDENT
• Resist the urge to write in whatever languageyou are most comfortablewith
• It saves time in a long run!
• ADVANTAGES OF PSEUDO CODE
• It can quickly and easily converted into an actual programming language as it is similar to a programming language
• It is fairly easy to understand, even for non programmers
• It doesn’t matter if there are errors in the syntax. It is usually still obvious what is intended
• Changes to the design can be incorporated quite easily
DISADVANTAGES OF PSEUDO CODE
• It can be hard to see how a program flows.e.g; where does following one path as opposed to another take the program?
• It can be time consuming to produce
EXAMPLE OF WHAT IT LOOKS LIKE
SCHEDULING ALGORITHM (ROUND-ROBIN)
• The name of this algorithm comes from the round-robin principal, where each person gets an equal share of something
in turns
• In round-robin scheduling, each ready task runs turn by turn only in a cyclic queue for a limited time slice
• This algorithm also offers starvation free execution of process
CHARACTERISTICS OF ROUND-ROBIN
• Round-robin is pre-emptive algorithm
• It is a hybrid model which is clock-driven
• It is a real time algorithm which responds to the event within a specific time limit
• Round-robin is one of the oldest, fairest and easiest algorithm
• Widely used scheduling method in traditional O.S
EXAMPLES OF ROUND-ROBIN SCHEDULING
PROCESS QUEUE. BURST TIME
P1. 4
P2. 3
P3. 5
EXAMPLE OF ROUND-ROBIN SCHEDULING
• STEP 1: The execution begins with process P1, which has burst time 4.
• Here every process executes for 2 seconds. P2 and P3 are still in the waiting queue
CONTINUATION OF EXAMPLE
• STEP 2: At time=2, P1 is added to the end of the queue and P2 starts executing
EXAMPLE CONT…
• STEP 3: At time=4, P2 is preempted and add at the end of of the queue. P3 starts executing
CONT……
• STEP4: At the time=6, P3 is preempted and add at the end of the queue. P1 starts executing
CONT….
• STEP 5: At time=8, P1 has a burst time of of 4. It has completed execution. P2 starts executing
CONT….
• STEP 6: P2 has a burst time of 3. It has already executed for 2 intervals. At time=9, P2 completes execution. Then P3
starts executing till it completes.
CONT….
• STEP 7: Calculate the average waiting time for above example
ADVANTAGES OF ROUND-ROBIN SCHEDULING
• It doesn’t face the issues of starvation or convey effect
• All the jobs get a fair allocation of CPU
• It deals with all process without any priority
• Easy to assume the worst-case response time for the same Processes. Provided the total number of processes on the run
queue is known
• It gives the best performance in terms of average response time
DISADVANTAGES OF ROUND-ROBIN SCHEDULING
• This method spends more time on context switching
• Its performance heavily depends on time quantum
• Priorities cannot be set for the processes
• It doesn’t give special priority to more important tasks

Presentation.pdf

  • 1.
  • 2.
    GROUP MEMBERS • CLEMENTCHULU • FLAVIOUR CHIPAMBA • SAMUEL SIANAMATE • BLESSINGTON MUSONDA • HAPPY NG’AMBI
  • 3.
    PROCESS SCHEDULING • Proceessscheduling is an Operating System(O.S) task that schedules processes of different states like ready, waiting and running • It allows O.S to allocate a time interval of CPU execution for each process • It is very important because it keeps the CPU busy all the time
  • 4.
    PROCESS SCHEDULING QUEUES •A queue is simply a collection of processes n storage that are waiting to be brought into memory to run a program • Therefore, PSQ help the user to maintain a distinct queue for each and every process States and Printed CircuitBoards (PCBs) • This is done in such a waythat all processes of the same execution state are placed in the same queue 1. Job queue: keeps or stores all the processesin the system 2. Ready queue: keeps a set of all processesresiding in main memory which are ready and waitingto execute 3. Device queue: constitutes of processeswhich are blocked due to unavailability of I/O device
  • 5.
  • 6.
    TWO STATE PROCESSMODEL 1. Running state: In the O.S, whenever a new process is built, it is entered into the system which should be running 2. Not Running state: Processes that are not running are kept in a queue, which is waiting for their turn to execute
  • 7.
    SCHEDULING OBJECTIVES • Maximizethe number of interactive users within acceptable response times • Achieve a balance between response and utilization • Avoid definite postponement and enforce priorities • It also should give reference to the processes holding the key resources
  • 8.
    TYPES OF PROCESSSCHEDULRS • A scheduler is a type of system software that allows the user to handle process scheduling • There are mainly three types of schedulers: 1. LONG TERM SCHEDULER- This is also known as the job scheduler. It regulates the program and select process from the queue and leads them into memory for execution • It’s main is to offer a balanced mix of jobs like processor, I/O jobs, that allow managing multiprogramming 2. MEDIUM TERM SCHEDULER- It’s an important part of swapping, for it enables the user to handle the swapped out-processes • In this scheduler, a running process can become suspended. Which makes I/O request. • A suspended process can’t make progress toward completion. In order to remove the process from memory and make space for other processes. The suspended process should be moved to secondary storage 3. SHORT TERM SCHEDULER-This is also known as CPU scheduler • Its main goal is to boost the system performance according to set criteria • This helps the user to select from a group of processes that are ready to execute and allocates CPUto one of them
  • 9.
    DIFFERENCE BETWEEN SCHEDULRS LONGTERM SHORT TERM MIDDLE TERM • It’s also known as job scheduler • Also known as a CPU scheduler • Is also called swapping scheduler • It’s either absent or minimal in a time sharing system • It is significant in the time sharing order • It’s an element of Time-sharing systems • Speed is less compared to the short term scheduler • Speed is the fastest compared to the long term and medium term scheduler • It offers medium speed • Allows user to select process from the loads and pool back into the memory • It only selects processes that is in a ready state of the execution • It helps users to send process back to memory • Offers full control • Offers less control • Reduce the level of multiprogramming
  • 10.
    PSEUDO CODE CONCEPTS •Pseudocode is a simple wayof writing programming code in English • It is not actual programming language • It is offen used in all various fields of programming, wether it be app development, data science, or web development • Pseudocode is a technique used to describe the distinctsteps of an algorithm in a manner that is easy to understand for anyone with basic programming knowledge • It uses short terms or simple English language syntaxesto writecode for programs before it is actually converted into a specific programming language
  • 11.
    MAIN CONSTRUCTS OFPSEUDO CODE • The core of pseudocode is the ability to represent 6 programming constructs.( Always written in upper case): SEQUENCE, CASE, WHILE, REPEAT-UNTIL, FOR and IF-THEN-ELSE • These constructs also called keywords are used to describe the control flow of the algorithm • SEQUENCE: Represents linear tasks sequentially performed one after the other • WHILE: A loop with a condition at it’s beginning • REPEAT-UNTIL: A loop with a condition at the bottom • FOR: Another way of looping • IF-THEN-ELSE: A condition statement changing the flow of the algorithm • CASE: The generalizationform of IF-THEN-ELSE
  • 12.
    RULES FOR PSEUDOCODE •Example; • TASK LIST: Read name, hourlyrate, hoursworked, deduction rate, Perform calculations grossPay=hourly Rate*hourly Worked deduuction=gross pay*deduction Rate netPay=grossPay – deduction Write name, grossdeduction, netpay • PSEUDOCODE READname, hourlyRate,hours worked,deductionRate grossPay=hourlyRate*hourlyWorked deduction=grossPay*deductionRate netPay= grossPay– deduction WRITE name, grossPay, deduction,netPay
  • 13.
    RULES FOR PSEUDOCODE 1.WRITE ONLY 1 STATEMENT PER LINE • Each statement should express just one action for the computer 2. CAPITALIZE INITIAL KEY WORDS • In the above example, READ and WRITE are in caps • There are just a few keywords used • READ, WRITE, IF, ELSE,END IF, WHILE, END WHILE, REPEAT-UNTIL 3. INDENT TO SHOW HIERARCHY • A particular indentation pattern in each of the design structure is used: • SEQUENCE – Keeps the statements that are stacked in sequence all starting in the same column • SELECTION – Indent the statements that fall inside the selection structure, but not the key words that form the selection • LOOPING – Indent the statements that fall inside the loop,but not keywords that form the loop - In the above example, employeeswhose grossPayisless than 100 do nothave anydeduction.E.g:
  • 14.
    RULES FOR PSEUDOCODE 4. END MULTILINE STRUCTURES • See how the IF/ELSE/END IF is constructedabove • The END IF or ( END Whatever) always is in line with the IF or (whatever starts thestructure). 5. KEEP STATEMENTS LANGUAGE INDEPENDENT • Resist the urge to write in whatever languageyou are most comfortablewith • It saves time in a long run!
  • 15.
    • ADVANTAGES OFPSEUDO CODE • It can quickly and easily converted into an actual programming language as it is similar to a programming language • It is fairly easy to understand, even for non programmers • It doesn’t matter if there are errors in the syntax. It is usually still obvious what is intended • Changes to the design can be incorporated quite easily
  • 16.
    DISADVANTAGES OF PSEUDOCODE • It can be hard to see how a program flows.e.g; where does following one path as opposed to another take the program? • It can be time consuming to produce
  • 17.
    EXAMPLE OF WHATIT LOOKS LIKE
  • 18.
    SCHEDULING ALGORITHM (ROUND-ROBIN) •The name of this algorithm comes from the round-robin principal, where each person gets an equal share of something in turns • In round-robin scheduling, each ready task runs turn by turn only in a cyclic queue for a limited time slice • This algorithm also offers starvation free execution of process
  • 19.
    CHARACTERISTICS OF ROUND-ROBIN •Round-robin is pre-emptive algorithm • It is a hybrid model which is clock-driven • It is a real time algorithm which responds to the event within a specific time limit • Round-robin is one of the oldest, fairest and easiest algorithm • Widely used scheduling method in traditional O.S
  • 20.
    EXAMPLES OF ROUND-ROBINSCHEDULING PROCESS QUEUE. BURST TIME P1. 4 P2. 3 P3. 5
  • 21.
    EXAMPLE OF ROUND-ROBINSCHEDULING • STEP 1: The execution begins with process P1, which has burst time 4. • Here every process executes for 2 seconds. P2 and P3 are still in the waiting queue
  • 22.
    CONTINUATION OF EXAMPLE •STEP 2: At time=2, P1 is added to the end of the queue and P2 starts executing
  • 23.
    EXAMPLE CONT… • STEP3: At time=4, P2 is preempted and add at the end of of the queue. P3 starts executing
  • 24.
    CONT…… • STEP4: Atthe time=6, P3 is preempted and add at the end of the queue. P1 starts executing
  • 25.
    CONT…. • STEP 5:At time=8, P1 has a burst time of of 4. It has completed execution. P2 starts executing
  • 26.
    CONT…. • STEP 6:P2 has a burst time of 3. It has already executed for 2 intervals. At time=9, P2 completes execution. Then P3 starts executing till it completes.
  • 27.
    CONT…. • STEP 7:Calculate the average waiting time for above example
  • 28.
    ADVANTAGES OF ROUND-ROBINSCHEDULING • It doesn’t face the issues of starvation or convey effect • All the jobs get a fair allocation of CPU • It deals with all process without any priority • Easy to assume the worst-case response time for the same Processes. Provided the total number of processes on the run queue is known • It gives the best performance in terms of average response time
  • 29.
    DISADVANTAGES OF ROUND-ROBINSCHEDULING • This method spends more time on context switching • Its performance heavily depends on time quantum • Priorities cannot be set for the processes • It doesn’t give special priority to more important tasks