now let us discuss about operating system structures we have mainly two types of operating system structures the first one is multi-programming operating system multi-programming operating system second one is time sharing operating system operating system structures and type of operating systems both are same only so first let us see about multi-programming operating system the name itself specifies the meaning multiprogramming means placing multiple programs in the main memory so that we can utilize the efficiency of CPU in effective manner we know that main memory is divided in into two parts the first part is operating system whereas the second part is user programs so let we have three programs so P1 P2 P3 so multi-programming means keeping more number of programs in the main memory so now we have three programs in the main memory let CPU is a executing P1 let CPU is executing P1 assumes that P1 needs IO operation during that time CPU will be ID why because P1 needs some IA operation so for that we require some activities so during that time CPU is ID so now what the operating system will do do is operating system will allocates CPU to some other process we know that process means a program during execution here three programs are present in the main memory CPU is executing those programs so now we can call them as processes process means a program under execution so now CPU will start executing process P2 assumes that P2 also needs some IO operation so during that time CPU will be idal so what the operating system will do operating system will elocate CPU to some other process so now he assumes that operating system allocated CPU to P3 so now CPU starts executing P3 process so likewise all the processes are executed concurrently simultaneously so that we can utilize efficiency of the CPU in effective manner here M here CPU access speed is very very faster whereas main memory access speed is slower when compared with the CPU access speed so in order to compensate the difference we have to keep more number of programs in the main memory so operating system will place more number of programs in the main memory so let us assume that uh we have 100 programs present in the main memory from P1 to P 100 but we know that the size of the main memory is very very small when compared with hard dis size whenever we save a program then the corresponding program will be stored St in hard disk so at the time of execution those programs will be transferred from hard disk into the main memory so main memory contains only the programs that are currently executing by CPU that are currently needed by CPU so this is the advantage of multiprogramming so multi-programming means keeping more number of programs in the main memory so that we can utilize CPU performance in effective manner so that is about what is multiprogramming now let us see about the second one that is time sharing system time sharing is an extension to multiprogramming where the corresponding CPU time will be shared between the available processes so time sharing the name itself specifies the meaning the name itself specifies the meaning the CPU time will be shared between the available processes so let we have three processes such as P1 P2 P3 present in the main memory assumes that P1 needs 4 milliseconds of CPU time for its execution likewise assumes that P2 needs needs 6 milliseconds of CPU time for its execution likewise assumes that P3 needs 8 milliseconds of CPU time for its execution so here what will happen is operating system allocates CPU for a particular time slot only so let us assume that operating system allocated 2 milliseconds for the CPU so now CPU can EXE executes a process only for 2 milliseconds so what will happen P1 will be executed for 2 milliseconds so remaining time is 2 milliseconds P1 need 2 more milliseconds for its execution likewise CPU executed P2 for uh 2 milliseconds so remaining time is 4 milliseconds likewise CPU executed P3 for uh 2 milliseconds so remaining time is 6 millisecs seconds so next year again CPU starts executing P1 P2 P3 likewise all the processes will be executed so here what will happen is uh the CPU switches from one process to another process very frequently so that's why time sharing systems produces more interactiveness the user feels that let we have three users uh generally we are using multi-user system so let we let we have three users so let P1 belongs to user 1 P2 process belongs to user 2 P3 process belongs to user 3 so all the three users will feels that CPU is executing their process only