processes-03 - Processes and Interprocess Communication...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Processes and Interprocess Communication
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Announcements
Background image of page 2
Processes
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Why Processes? Simplicity + Speed Hundreds of things going on in the system How to make things simple? Separate each in an isolated process Decomposition How to speed-up? Overlap I/O bursts of one process with CPU bursts of another gcc emacs nfsd lpr ls www emacs nfsd lpr ls www OS OS
Background image of page 4
What is a process? A task created by the OS, running in a restricted virtual machine environment –a virtual CPU, virtual memory environment, interface to the OS via system calls The unit of execution The unit of scheduling Thread of execution + address space Is a program in execution Sequential, instruction-at-a-time execution of a program. The same as “job” or “task” or “sequential process”
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What is a program? A program consists of: Code: machine instructions Data: variables stored and manipulated in memory initialized variables (globals) dynamically allocated variables (malloc, new) stack variables (C automatic variables, function arguments) DLLs: libraries that were not compiled or linked with the program mapped files: memory segments containing variables (mmap()) • used frequently in database programs A process is a executing program
Background image of page 6
Preparing a Program source file compiler/ assembler .o files Linker Executable file (must follow standard format, such as ELF on Linux, Microsoft PE on Windows) Header Code Initialized data BSS Symbol table Line numbers Ext. refs static libraries (libc, streams…)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Running a program OS creates a “process” and allocates memory for it The loader: reads and interprets the executable file pushes “argc”, “argv”, “envp” on the stack Program start running at __start(), which calls main() we say “process” is running, and no longer think of “program” When main() returns, CRT0 calls “exit()” destroys the process and returns all resources
Background image of page 8
Process != Program Header Code Initialized data BSS Symbol table Line numbers Ext. refs Code Initialized data BSS Heap Stack DLL’s mapped segments Executable Process address space Program is passive Code + data Process is running program stack, regs, program counter Example: We both run IE: - Same program - Separate processes
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 32

processes-03 - Processes and Interprocess Communication...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online