15. A OS that allows multiple
users to use the same
computer at the same time or
at different times is
*
O Single user os
O Multi user os
O Multi threading os.
Answers
Answer:
Difference between Multiprogramming, multitasking, multithreading and multiprocessing
Multiprogramming – A computer running more than one program at a time (like running Excel and Firefox simultaneously).
Multiprocessing – A computer using more than one CPU at a time.
Multitasking – Tasks sharing a common resource (like 1 CPU).
Multithreading is an extension of multitasking.
1. Multi programming –
In a modern computing system, there are usually several concurrent application processes which want to execute. Now it is the responsibility of the Operating System to manage all the processes effectively and efficiently.
One of the most important aspects of an Operating System is to multi program.
In a computer system, there are multiple processes waiting to be executed, i.e. they are waiting when the CPU will be allocated to them and they begin their execution. These processes are also known as jobs. Now the main memory is too small to accommodate all of these processes or jobs into it. Thus, these processes are initially kept in an area called job pool. This job pool consists of all those processes awaiting allocation of main memory and CPU.
CPU selects one job out of all these waiting jobs, brings it from the job pool to main memory and starts executing it. The processor executes one job until it is interrupted by some external factor or it goes for an I/O task.
Non-multi programmed system’s working –
In a non multi programmed system, As soon as one job leaves the CPU and goes for some other task (say I/O ), the CPU becomes idle. The CPU keeps waiting and waiting until this job (which was executing earlier) comes back and resumes its execution with the CPU. So CPU remains free for all this while.
Now it has a drawback that the CPU remains idle for a very long period of time. Also, other jobs which are waiting to be executed might not get a chance to execute because the CPU is still allocated to the earlier job.
This poses a very serious problem that even though other jobs are ready to execute, CPU is not allocated to them as the CPU is allocated to a job which is not even utilizing it (as it is busy in I/O tasks).
It cannot happen that one job is using the CPU for say 1 hour while the others have been waiting in the queue for 5 hours. To avoid situations like this and come up with efficient utilization of CPU, the concept of multi programming came up.
The main idea of multi programming is to maximize the CPU time.
Multi programmed system’s working –
In a multi-programmed system, as soon as one job goes for an I/O task, the Operating System interrupts that job, chooses another job from the job pool (waiting queue), gives CPU to this new job and starts its execution. The previous job keeps doing its I/O operation while this new job does CPU bound tasks. Now say the second job also goes for an I/O task, the CPU chooses a third job and starts executing it. As soon as a job completes its I/O operation and comes back for CPU tasks, the CPU is allocated to it.
In this way, no CPU time is wasted by the system waiting for the I/O task to be completed.
Therefore, the ultimate goal of multi programming is to keep the CPU busy as long as there are processes ready to execute. This way, multiple programs can be executed on a single processor by executing a part of a program at one time, a part of another program after this, then a part of another program and so on, hence executing multiple programs. Hence, the CPU never remains idle.
In the image below, program A runs for some time and then goes to waiting state. In the mean time program B begins its execution. So the CPU does not waste its resources and gives program B an opportunity to run.
2. .
ᴅɪғғᴇʀᴇɴᴄᴇ ʙᴇᴛᴡᴇᴇɴ ᴍᴜʟᴛɪᴘʀᴏɢʀᴀᴍᴍɪɴɢ, ᴍᴜʟᴛɪᴛᴀsᴋɪɴɢ, ᴍᴜʟᴛɪᴛʜʀᴇᴀᴅɪɴɢ ᴀɴᴅ ᴍᴜʟᴛɪᴘʀᴏᴄᴇssɪɴɢ ᴍᴜʟᴛɪᴘʀᴏɢʀᴀᴍᴍɪɴɢ –
ᴀ ᴄᴏᴍᴘᴜᴛᴇʀ ʀᴜɴɴɪɴɢ ᴍᴏʀᴇ ᴛʜᴀɴ ᴏɴᴇ ᴘʀᴏɢʀᴀᴍ ᴀᴛ ᴀ ᴛɪᴍᴇ (ʟɪᴋᴇ ʀᴜɴɴɪɴɢ ᴇxᴄᴇʟ ᴀɴᴅ ғɪʀᴇғᴏx sɪᴍᴜʟᴛᴀɴᴇᴏᴜsʟʏ). ᴍᴜʟᴛɪᴘʀᴏᴄᴇssɪɴɢ –
ᴀ ᴄᴏᴍᴘᴜᴛᴇʀ ᴜsɪɴɢ ᴍᴏʀᴇ ᴛʜᴀɴ ᴏɴᴇ ᴄᴘᴜ ᴀᴛ ᴀ ᴛɪᴍᴇ. ᴍᴜʟᴛɪᴛᴀsᴋɪɴɢ – ᴛᴀsᴋs sʜᴀʀɪɴɢ ᴀ ᴄᴏᴍᴍᴏɴ ʀᴇsᴏᴜʀᴄᴇ (ʟɪᴋᴇ ᴄᴘᴜ). ᴍᴜʟᴛɪᴛʜʀᴇᴀᴅɪɴɢ ɪs ᴀɴ ᴇxᴛᴇɴsɪᴏɴ ᴏғ ᴍᴜʟᴛɪᴛᴀsᴋɪɴɢ. . ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍᴍɪɴɢ –
ɪɴ ᴀ ᴍᴏᴅᴇʀɴ ᴄᴏᴍᴘᴜᴛɪɴɢ sʏsᴛᴇᴍ, ᴛʜᴇʀᴇ ᴀʀᴇ ᴜsᴜᴀʟʟʏ sᴇᴠᴇʀᴀʟ ᴄᴏɴᴄᴜʀʀᴇɴᴛ ᴀᴘᴘʟɪᴄᴀᴛɪᴏɴ ᴘʀᴏᴄᴇssᴇs ᴡʜɪᴄʜ ᴡᴀɴᴛ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ. ɴᴏᴡ ɪᴛ ɪs ᴛʜᴇ ʀᴇsᴘᴏɴsɪʙɪʟɪᴛʏ ᴏғ ᴛʜᴇ ᴏᴘᴇʀᴀᴛɪɴɢ sʏsᴛᴇᴍ ᴛᴏ ᴍᴀɴᴀɢᴇ ᴀʟʟ ᴛʜᴇ ᴘʀᴏᴄᴇssᴇs ᴇғғᴇᴄᴛɪᴠᴇʟʏ ᴀɴᴅ ᴇғғɪᴄɪᴇɴᴛʟʏ. ᴏɴᴇ ᴏғ ᴛʜᴇ ᴍᴏsᴛ ɪᴍᴘᴏʀᴛᴀɴᴛ ᴀsᴘᴇᴄᴛs ᴏғ ᴀɴ ᴏᴘᴇʀᴀᴛɪɴɢ sʏsᴛᴇᴍ ɪs ᴛᴏ ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍ. ɪɴ ᴀ ᴄᴏᴍᴘᴜᴛᴇʀ sʏsᴛᴇᴍ, ᴛʜᴇʀᴇ ᴀʀᴇ ᴍᴜʟᴛɪᴘʟᴇ ᴘʀᴏᴄᴇssᴇs ᴡᴀɪᴛɪɴɢ ᴛᴏ ʙᴇ ᴇxᴇᴄᴜᴛᴇᴅ, ɪ.ᴇ. ᴛʜᴇʏ ᴀʀᴇ ᴡᴀɪᴛɪɴɢ ᴡʜᴇɴ ᴛʜᴇ ᴄᴘᴜ ᴡɪʟʟ ʙᴇ ᴀʟʟᴏᴄᴀᴛᴇᴅ ᴛᴏ ᴛʜᴇᴍ ᴀɴᴅ ᴛʜᴇʏ ʙᴇɢɪɴ ᴛʜᴇɪʀ ᴇxᴇᴄᴜᴛɪᴏɴ. ᴛʜᴇsᴇ ᴘʀᴏᴄᴇssᴇs ᴀʀᴇ ᴀʟsᴏ ᴋɴᴏᴡɴ ᴀs ᴊᴏʙs. ɴᴏᴡ ᴛʜᴇ ᴍᴀɪɴ ᴍᴇᴍᴏʀʏ ɪs ᴛᴏᴏ sᴍᴀʟʟ ᴛᴏ ᴀᴄᴄᴏᴍᴍᴏᴅᴀᴛᴇ ᴀʟʟ ᴏғ ᴛʜᴇsᴇ ᴘʀᴏᴄᴇssᴇs ᴏʀ ᴊᴏʙs ɪɴᴛᴏ ɪᴛ. ᴛʜᴜs, ᴛʜᴇsᴇ ᴘʀᴏᴄᴇssᴇs ᴀʀᴇ ɪɴɪᴛɪᴀʟʟʏ ᴋᴇᴘᴛ ɪɴ ᴀɴ ᴀʀᴇᴀ ᴄᴀʟʟᴇᴅ ᴊᴏʙ ᴘᴏᴏʟ. ᴛʜɪs ᴊᴏʙ ᴘᴏᴏʟ ᴄᴏɴsɪsᴛs ᴏғ ᴀʟʟ ᴛʜᴏsᴇ ᴘʀᴏᴄᴇssᴇs ᴀᴡᴀɪᴛɪɴɢ ᴀʟʟᴏᴄᴀᴛɪᴏɴ ᴏғ ᴍᴀɪɴ ᴍᴇᴍᴏʀʏ ᴀɴᴅ ᴄᴘᴜ. ᴄᴘᴜ sᴇʟᴇᴄᴛs ᴏɴᴇ ᴊᴏʙ ᴏᴜᴛ ᴏғ ᴀʟʟ ᴛʜᴇsᴇ ᴡᴀɪᴛɪɴɢ ᴊᴏʙs, ʙʀɪɴɢs ɪᴛ ғʀᴏᴍ ᴛʜᴇ ᴊᴏʙ ᴘᴏᴏʟ ᴛᴏ ᴍᴀɪɴ ᴍᴇᴍᴏʀʏ ᴀɴᴅ sᴛᴀʀᴛs ᴇxᴇᴄᴜᴛɪɴɢ ɪᴛ. ᴛʜᴇ ᴘʀᴏᴄᴇssᴏʀ ᴇxᴇᴄᴜᴛᴇs ᴏɴᴇ ᴊᴏʙ ᴜɴᴛɪʟ ɪᴛ ɪs ɪɴᴛᴇʀʀᴜᴘᴛᴇᴅ ʙʏ sᴏᴍᴇ ᴇxᴛᴇʀɴᴀʟ ғᴀᴄᴛᴏʀ ᴏʀ ɪᴛ ɢᴏᴇs ғᴏʀ ᴀɴ ɪ/ᴏ ᴛᴀsᴋ.
ɴᴏɴ-ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍᴍᴇᴅ sʏsᴛᴇᴍ’s ᴡᴏʀᴋɪɴɢ –
ɪɴ ᴀ ɴᴏɴ ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍᴍᴇᴅ sʏsᴛᴇᴍ, ᴀs sᴏᴏɴ ᴀs ᴏɴᴇ ᴊᴏʙ ʟᴇᴀᴠᴇs ᴛʜᴇ ᴄᴘᴜ ᴀɴᴅ ɢᴏᴇs ғᴏʀ sᴏᴍᴇ ᴏᴛʜᴇʀ ᴛᴀsᴋ (sᴀʏ ɪ/ᴏ ), ᴛʜᴇ ᴄᴘᴜ ʙᴇᴄᴏᴍᴇs ɪᴅʟᴇ. ᴛʜᴇ ᴄᴘᴜ ᴋᴇᴇᴘs ᴡᴀɪᴛɪɴɢ ᴀɴᴅ ᴡᴀɪᴛɪɴɢ ᴜɴᴛɪʟ ᴛʜɪs ᴊᴏʙ (ᴡʜɪᴄʜ ᴡᴀs ᴇxᴇᴄᴜᴛɪɴɢ ᴇᴀʀʟɪᴇʀ) ᴄᴏᴍᴇs ʙᴀᴄᴋ ᴀɴᴅ ʀᴇsᴜᴍᴇs ɪᴛs ᴇxᴇᴄᴜᴛɪᴏɴ ᴡɪᴛʜ ᴛʜᴇ ᴄᴘᴜ. sᴏ ᴄᴘᴜ ʀᴇᴍᴀɪɴs ғʀᴇᴇ ғᴏʀ ᴀʟʟ ᴛʜɪs ᴡʜɪʟᴇ. ɴᴏᴡ ɪᴛ ʜᴀs ᴀ ᴅʀᴀᴡʙᴀᴄᴋ ᴛʜᴀᴛ ᴛʜᴇ ᴄᴘᴜ ʀᴇᴍᴀɪɴs ɪᴅʟᴇ ғᴏʀ ᴀ ᴠᴇʀʏ ʟᴏɴɢ ᴘᴇʀɪᴏᴅ ᴏғ ᴛɪᴍᴇ. ᴀʟsᴏ, ᴏᴛʜᴇʀ ᴊᴏʙs ᴡʜɪᴄʜ ᴀʀᴇ ᴡᴀɪᴛɪɴɢ ᴛᴏ ʙᴇ ᴇxᴇᴄᴜᴛᴇᴅ ᴍɪɢʜᴛ ɴᴏᴛ ɢᴇᴛ ᴀ ᴄʜᴀɴᴄᴇ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ ʙᴇᴄᴀᴜsᴇ ᴛʜᴇ ᴄᴘᴜ ɪs sᴛɪʟʟ ᴀʟʟᴏᴄᴀᴛᴇᴅ ᴛᴏ ᴛʜᴇ ᴇᴀʀʟɪᴇʀ ᴊᴏʙ. ᴛʜɪs ᴘᴏsᴇs ᴀ ᴠᴇʀʏ sᴇʀɪᴏᴜs ᴘʀᴏʙʟᴇᴍ ᴛʜᴀᴛ ᴇᴠᴇɴ ᴛʜᴏᴜɢʜ ᴏᴛʜᴇʀ ᴊᴏʙs ᴀʀᴇ ʀᴇᴀᴅʏ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ, ᴄᴘᴜ ɪs ɴᴏᴛ ᴀʟʟᴏᴄᴀᴛᴇᴅ ᴛᴏ ᴛʜᴇᴍ ᴀs ᴛʜᴇ ᴄᴘᴜ ɪs ᴀʟʟᴏᴄᴀᴛᴇᴅ ᴛᴏ ᴀ ᴊᴏʙ ᴡʜɪᴄʜ ɪs ɴᴏᴛ ᴇᴠᴇɴ ᴜᴛɪʟɪᴢɪɴɢ ɪᴛ (ᴀs ɪᴛ ɪs ʙᴜsʏ ɪɴ ɪ/ᴏ ᴛᴀsᴋs). ɪᴛ ᴄᴀɴɴᴏᴛ ʜᴀᴘᴘᴇɴ ᴛʜᴀᴛ ᴏɴᴇ ᴊᴏʙ ɪs ᴜsɪɴɢ ᴛʜᴇ ᴄᴘᴜ ғᴏʀ sᴀʏ ʜᴏᴜʀ ᴡʜɪʟᴇ ᴛʜᴇ ᴏᴛʜᴇʀs ʜᴀᴠᴇ ʙᴇᴇɴ ᴡᴀɪᴛɪɴɢ ɪɴ ᴛʜᴇ ǫᴜᴇᴜᴇ ғᴏʀ ʜᴏᴜʀs. ᴛᴏ ᴀᴠᴏɪᴅ sɪᴛᴜᴀᴛɪᴏɴs ʟɪᴋᴇ ᴛʜɪs ᴀɴᴅ ᴄᴏᴍᴇ ᴜᴘ ᴡɪᴛʜ ᴇғғɪᴄɪᴇɴᴛ ᴜᴛɪʟɪᴢᴀᴛɪᴏɴ ᴏғ ᴄᴘᴜ, ᴛʜᴇ ᴄᴏɴᴄᴇᴘᴛ ᴏғ ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍᴍɪɴɢ ᴄᴀᴍᴇ ᴜᴘ. ᴛʜᴇ ᴍᴀɪɴ ɪᴅᴇᴀ ᴏғ ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍᴍɪɴɢ ɪs ᴛᴏ ᴍᴀxɪᴍɪᴢᴇ ᴛʜᴇ ᴄᴘᴜ ᴛɪᴍᴇ. ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍᴍᴇᴅ sʏsᴛᴇᴍ’s ᴡᴏʀᴋɪɴɢ – ɪɴ ᴀ ᴍᴜʟᴛɪ-ᴘʀᴏɢʀᴀᴍᴍᴇᴅ sʏsᴛᴇᴍ, ᴀs sᴏᴏɴ ᴀs ᴏɴᴇ ᴊᴏʙ ɢᴏᴇs ғᴏʀ ᴀɴ ɪ/ᴏ ᴛᴀsᴋ, ᴛʜᴇ ᴏᴘᴇʀᴀᴛɪɴɢ sʏsᴛᴇᴍ ɪɴᴛᴇʀʀᴜᴘᴛs ᴛʜᴀᴛ ᴊᴏʙ, ᴄʜᴏᴏsᴇs ᴀɴᴏᴛʜᴇʀ ᴊᴏʙ ғʀᴏᴍ ᴛʜᴇ ᴊᴏʙ ᴘᴏᴏʟ (ᴡᴀɪᴛɪɴɢ ǫᴜᴇᴜᴇ), ɢɪᴠᴇs ᴄᴘᴜ ᴛᴏ ᴛʜɪs ɴᴇᴡ ᴊᴏʙ ᴀɴᴅ sᴛᴀʀᴛs ɪᴛs ᴇxᴇᴄᴜᴛɪᴏɴ. ᴛʜᴇ ᴘʀᴇᴠɪᴏᴜs ᴊᴏʙ ᴋᴇᴇᴘs ᴅᴏɪɴɢ ɪᴛs ɪ/ᴏ ᴏᴘᴇʀᴀᴛɪᴏɴ ᴡʜɪʟᴇ ᴛʜɪs ɴᴇᴡ ᴊᴏʙ ᴅᴏᴇs ᴄᴘᴜ ʙᴏᴜɴᴅ ᴛᴀsᴋs. ɴᴏᴡ sᴀʏ ᴛʜᴇ sᴇᴄᴏɴᴅ ᴊᴏʙ ᴀʟsᴏ ɢᴏᴇs ғᴏʀ ᴀɴ ɪ/ᴏ ᴛᴀsᴋ, ᴛʜᴇ ᴄᴘᴜ ᴄʜᴏᴏsᴇs ᴀ ᴛʜɪʀᴅ ᴊᴏʙ ᴀɴᴅ sᴛᴀʀᴛs ᴇxᴇᴄᴜᴛɪɴɢ ɪᴛ. ᴀs sᴏᴏɴ ᴀs ᴀ ᴊᴏʙ ᴄᴏᴍᴘʟᴇᴛᴇs ɪᴛs ɪ/ᴏ ᴏᴘᴇʀᴀᴛɪᴏɴ ᴀɴᴅ ᴄᴏᴍᴇs ʙᴀᴄᴋ ғᴏʀ ᴄᴘᴜ ᴛᴀsᴋs, ᴛʜᴇ ᴄᴘᴜ ɪs ᴀʟʟᴏᴄᴀᴛᴇᴅ ᴛᴏ ɪᴛ. ɪɴ ᴛʜɪs ᴡᴀʏ, ɴᴏ ᴄᴘᴜ ᴛɪᴍᴇ ɪs ᴡᴀsᴛᴇᴅ ʙʏ ᴛʜᴇ sʏsᴛᴇᴍ ᴡᴀɪᴛɪɴɢ ғᴏʀ ᴛʜᴇ ɪ/ᴏ ᴛᴀsᴋ ᴛᴏ ʙᴇ ᴄᴏᴍᴘʟᴇᴛᴇᴅ. ᴛʜᴇʀᴇғᴏʀᴇ, ᴛʜᴇ ᴜʟᴛɪᴍᴀᴛᴇ ɢᴏᴀʟ ᴏғ ᴍᴜʟᴛɪ ᴘʀᴏɢʀᴀᴍᴍɪɴɢ ɪs ᴛᴏ ᴋᴇᴇᴘ ᴛʜᴇ ᴄᴘᴜ ʙᴜsʏ ᴀs ʟᴏɴɢ ᴀs ᴛʜᴇʀᴇ ᴀʀᴇ ᴘʀᴏᴄᴇssᴇs ʀᴇᴀᴅʏ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ. ᴛʜɪs ᴡᴀʏ, ᴍᴜʟᴛɪᴘʟᴇ ᴘʀᴏɢʀᴀᴍs ᴄᴀɴ ʙᴇ ᴇxᴇᴄᴜᴛᴇᴅ ᴏɴ ᴀ sɪɴɢʟᴇ ᴘʀᴏᴄᴇssᴏʀ ʙʏ ᴇxᴇᴄᴜᴛɪɴɢ ᴀ ᴘᴀʀᴛ ᴏғ ᴀ ᴘʀᴏɢʀᴀᴍ ᴀᴛ ᴏɴᴇ ᴛɪᴍᴇ, ᴀ ᴘᴀʀᴛ ᴏғ ᴀɴᴏᴛʜᴇʀ ᴘʀᴏɢʀᴀᴍ ᴀғᴛᴇʀ ᴛʜɪs, ᴛʜᴇɴ ᴀ ᴘᴀʀᴛ ᴏғ ᴀɴᴏᴛʜᴇʀ ᴘʀᴏɢʀᴀᴍ ᴀɴᴅ sᴏ ᴏɴ, ʜᴇɴᴄᴇ ᴇxᴇᴄᴜᴛɪɴɢ ᴍᴜʟᴛɪᴘʟᴇ ᴘʀᴏɢʀᴀᴍs. ʜᴇɴᴄᴇ, ᴛʜᴇ ᴄᴘᴜ ɴᴇᴠᴇʀ ʀᴇᴍᴀɪɴs ɪᴅʟᴇ. ɪɴ ᴛʜᴇ ɪᴍᴀɢᴇ ʙᴇʟᴏᴡ, ᴘʀᴏɢʀᴀᴍ ᴀ ʀᴜɴs ғᴏʀ sᴏᴍᴇ ᴛɪᴍᴇ ᴀɴᴅ ᴛʜᴇɴ ɢᴏᴇs ᴛᴏ ᴡᴀɪᴛɪɴɢ sᴛᴀᴛᴇ. ɪɴ ᴛʜᴇ ᴍᴇᴀɴ ᴛɪᴍᴇ ᴘʀᴏɢʀᴀᴍ ʙ ʙᴇɢɪɴs ɪᴛs ᴇxᴇᴄᴜᴛɪᴏɴ. sᴏ ᴛʜᴇ ᴄᴘᴜ ᴅᴏᴇs ɴᴏᴛ ᴡᴀsᴛᴇ ɪᴛs ʀᴇsᴏᴜʀᴄᴇs ᴀɴᴅ ɢɪᴠᴇs ᴘʀᴏɢʀᴀᴍ ʙ ᴀɴ ᴏᴘᴘᴏʀᴛᴜɴɪᴛʏ ᴛᴏ ʀᴜɴ.