Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve part b In a co-operative multitasking operating system, the operating systems gives the appearance of running multiple processes at the same time by

image text in transcribed

Please solve part b

In a co-operative multitasking operating system, the operating systems gives the appearance of running multiple processes at the same time by switching which process is currently running on the CPU. Internally, the OS models the lifetime of a processes as moving between a series of states: Running, Blocked, and Runnable. (a) An extract from a C program is shown below, suppose that this code was exe- cuted on co-operative multitasking operating system. Which lines of the pro- gram would cause the operating system to move the process from the Running state to the Blocked state? #include #include #include #define PRIME LIMIT (1000000) int main(int arge, char **argv) int a,b; int prime (PRIME_LIMIT): char out (PRIME LIMIT); char *p*q*r; int offt int i, j,n, ip; if (argo 1000000 Il a > b) { fprintf(stderr, "Invalid arguments); exit(2); ) printf("Searching for prime numbers between 8d and do, a, b); (b) Another extract from the same C program is shown below. However, a co- operative multitasking operating system would not be able to move the pro- cess from the Running to the blocked state while this code was executing. Give a brief explanation of why a co-operative multitasking operating system would not be able to move the process between the two states and why a pre- emptive mutltiasking operating system would be able to. for (i = 3; i 0) ( if (i > a) break; ) for(j = i+1; j 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

Students also viewed these Databases questions

Question

Describe how leadership styles should be adapted to the situation

Answered: 1 week ago