Questions for today
What does "run" mean?How does code run on the CPU?CPU - Machine Code
The CPU implements "machine code" instructionsEach machine code instruction is incredibly simple-e.g. add 2 numbers-e.g. compare 2 numbersJavamanuscript code we"ve used: print(1, 2)Javascript is not machine codeJavamanuscript does not run on the CPU directlyJavamanuscript functions in translation -print(1, 2)converts to many machine instructions to actually run on the CPUOnly machine code runs on the CPU"Software" is the general category of code which runs on the hardware. If the hardware is a player piano, then the software is the music. The common instance is a "program" prefer Firefox -- software application you run on your computer to solve a certain problem. A computer system can run multiple programs at the same time and also is responsible for maintaining their memory sepaprice.A CPU understands a low level "machine code" language (also recognized as "aboriginal code"). The language of the machine code is hardwired right into the style of the CPU hardware; it is not somepoint that deserve to be adjusted at will certainly. Each family of compatible CPUs (e.g. the incredibly well-known Intel x86 family) has its very own, idiosyncratic machine code which is not compatible through the machine code of various other CPU family members.You are watching: The part of a computer that runs programs is called
What is a Program/App?

How Does a Program Run?
CPU runs a "fetch/execute cycle" -fetch one instruction in sequence -execute (run) that instruction, e.g. execute the addition -fetch the next instruction, and also so onRun a program = Start CPU running on its first instruction it runs down through every one of the machine code, running the program the routine will have actually instructions like "return to action 3" to keep it running Super straightforward machine code instructions run at the rate of 2 billion per-secondThe CPU runs instructions making use of a "fetch-execute" cycle: the CPU gets the initially instruction in the sequence, executes it (adding two numbers or whatever), then fetches the next instruction and executes it, and also so on. Some of the instructions influence the order that the CPU takes through the instruction sequence. For instance, an instruction could straight the CPU to jump back to an earlier suggest in the instruction sequence (loops are enforced this way), or to skip over the following instruction if a details condition is true (if-statements are enforced this way).
How Does a Program Start?
The file Firefox.exe has its instructions (in the file system)To begin Firefox.exe running: -Each program gets its own area of RAM -The RAM area holds the program"s code and data it manipulates -The instruction bytes are copied from storage to RAM -The CPU is directed to begin running at the first instruction -Now the routine is running!
See more: Living Well Is The Best Revenge Quote, George Herbert Quotes
What Starts Firefox Running? The "Operating System"
What are the measures to run Firefox?"Operating System" -e.g. Windows, Linux, Android, iOSOperating System = ManagementSet of supervisory programs that manage the computerThe operating system runs as soon as the computer system initially starts upManage the start/speak of programsManage RAMManage persistent storageComputers can run multiple programs at the very same timeOperating device keeps track of the information for each routine and shares resources (prefer RAM) among the programsThe "operating system" of a computer system is prefer an initial, supervisory routine that starts running once the computer initially starts up ("boots up"). The operating mechanism plays an invisible administrative and bookkeeping duty behind the scenes. When a lapoptimal or phone starts up, the operating device typically gets things organized and also then launches a "file explorer" routine which display screens obtainable programs and menus etc. that display the user what is accessible, permitting the user to navigate and run programs.The operating system keeps points arranged in the background so that multiple programs have the right to run at the very same time, which is well-known as "multitasking". The operating device offers each program its very own area of memory, so each regimen just accesses its own sources .. attempting to limit what an erroneous or malicious routine deserve to carry out. Keeping the programs separate is occasionally well-known as "sandboxing" .. mediating the accessibility of each routine so it opeprices separately, without interfering through other programs or the system all at once. Similarly, each regime has actually some accessibility to the display screen via a home window, however this output area is separated from the output of various other programs.Recall that a .exe file or whatever is essentially just a record of machine code instructions. When you double-click the regime, the operating mechanism "launches" the program, doing the housemaintaining actions of allocating a room of memory within RAM for the regime, loading the initially area of the program"s machine code into that memory, and ultimately directing the CPU to begin running that code.The Whole Picture - Scenarios
Now we have actually the whole image of a regimen running on the hardware. Look at widespread scenarios.Demo: bring up "Activity Monitor" (Mac) "Task Manager" (windows) -See all the programs running -Do something costly in Firefox, see its CPU % spike -Kill a program