200 likes | 287 Views
Lecture 10: Processes II-C. Address Space Services Drivers. Address Space. Process is given: Executable Code Global Data Heap Stack This is referred to as the process’ “address space”. Executable Code. Contains our binary code Is typically static in content
E N D
Lecture 10: Processes II-C • Address Space • Services • Drivers
Address Space • Process is given: • Executable Code • Global Data • Heap • Stack • This is referred to as the process’ “address space”
Executable Code • Contains our binary code • Is typically static in content • Self-modifiable code is dangerous! • Also has fixed size
Global Data • Contains both initialized and uninitialized data • inti = 42; • char c; • Has fixed size
Heap • Grows/shrinks as needed • New/delete (C++) • Malloc/free (C)
Stack • Grows/shrinks as needed • Stores “history” of function calls
Services • There are tasks that need to run in the background: • HTTP server software • Remote desktop software • Print servers • Anti-virus software • Windows services • Linux daemons
Services • Usually intended to run for the “duration of the boot” • Usually run with elevated privileges • Required due to the nature of what they do
Services • They are essentially just programs • Require… • …CPU time • …memory • …IO ports (sometimes)
Services • Typically 100+ services running at a time • How do we have resources to do any of “our” stuff? • Minimize the resources • Most services are just infinite loop • Listen for input, then react • Sleep in the middle
Services • How do we identify them? • Windows • Services tool • Linux • Usually end in a ‘d’ • E.g., httpd is the HTTP daemon • When do they start? • Some on start-up • Some “on-demand”
“init” process • It’s the first process • Process ID is 1 • Handles all of the start-up tasks • Makes use of other scripts to accomplish this • Stays around while OS is alive and kicking • Handles the shutdown
“init” process • Checks integrity of file systems • Check for devices and enable them • Allow terminal/GUI login • Generally, make sure things behave • Shut down the OS • Ask processes to stop • Kill all who ignore
“init” process • This is “extreme hand waving” • Check PIDs of “latest” process once you login • In Windows, I was in the 5,000s
Drivers • They’re kinda processes • They’re kinda not • Invoking ps will not show them • They listen for IO to/from devices • Upon getting IO, they act upon it • There’s a lot of information here • We’re going to avoid going too far* into the weeds *This is subjective