Search code examples
operating-systeminstruction-setclockratesmachine-instruction

Instructions per sec for Operating systems


I am new to Computer Architecture and Design. My question was a high level program Instruction set are executed in CPU one after another. Does it even involve Operating System instructions as overhead when executing these instructions ?. For Example: If in 2 GHz processor there are 2*10^9 instructions that can be executed in 2*10^9 clock cycles. Then the operating system always takes about 1*10^9 instructions to execute per second. Is this overhead always there and only another 1*10^9 instructions are available free for execution for other custom scheduled programs to execute ?

Does that mean operating systems should always have as less instructions to execute as possible so it can accomodate more of other programs to be executed ?


Solution

  • Yes to both questions, within limits.

    First, yes, if the OS is using 1e9 instructions/sec, there are only 1e9 instructions/sec left.

    Second, yes, you'd like to reduce that as much as possible; it's called "overhead".

    The "limits" are that the OS does do good things for you. Consider, for example, miltitasking, where the OS lets you run several programs concurrently, sharing the processor among them. On the one hand, there is overhead involved. On the other hand, without it you'd either leave the machine idle for long stretches when no program could run, or you'd have to simulate multitasking yourself -- which would take at least as many instructinos as the OS would.