processes-03 - Processes and Interprocess Communication...

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

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

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

View Full Document Right Arrow Icon
Announcements
Image of page 2
Processes
Image of page 3

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

View Full Document Right 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
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”
Image of page 5

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

View Full Document Right 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 containing code & data, possibly shared with other programs mapped files: memory segments containing variables (mmap()) used frequently in database programs A process is a executing program
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…)
Image of page 7

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

View Full Document Right Arrow Icon
Running a program OS creates a “process” and allocates memory for it The loader: reads and interprets the executable file sets process’s memory to contain code & data from executable pushes “argc”, “argv”, “envp” on the stack sets the CPU registers properly & calls “__start()” [Part of CRT0] 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
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
Image of page 9

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern