1 / 30

Processes

Processes. Process is a program in execution. Program is a static entity while process is an active entity. Process Control Block (PCB) is a data structure that holds essential process information. Process table is and array or link list of PCBs. The Internal Structure of Minix.

Download Presentation

Processes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Processes • Process is a program in execution. • Program is a static entity while process is an active entity. • Process Control Block (PCB) is a data structure that holds essential process information. • Process table is and array or link list of PCBs. Process management in Minix

  2. The Internal Structure of Minix • Minix is structured in four layers. User processes (Init) Server processes (MM, FS) I/O tasks and system task (Disk task) Process management Process management in Minix

  3. Process Management • Bottom layer of the structure. • Catches hardware interrupts and software traps. • Performs scheduling. • Handles messages between processes (checks for protection, locates send and receive buffers, copies messages between senders and receiver’s buffers.) Process management in Minix

  4. I/O Tasks (Drivers) • Second layer from the bottom. • There is one task per device type. • Example of tasks are:disk tasks, printer tasks, terminal tasks, etc.. • There is one special task: system task. System task provides for communication of MM and FS with the kernel and its data structures. Process management in Minix

  5. The Kernel • The layer 1 and 2 code (the process management code and the tasks) are linked together into a single binary program called the kernel. Process management in Minix

  6. Server Processes • Third layer from the bottom. • Provide useful services to the user processes such as MM (Memory Management) and FS (File system). • Less privileged than the process management and the tasks Process management in Minix

  7. Memory Manager • Memory manager carries out all the Minix system calls that involve memory management. • E.g. • FORK • EXEC • BRK Process management in Minix

  8. File System • File system carries out all the Minix file system calls. • E.g. • READ/WRITE • MOUNT • CHDIR Process management in Minix

  9. Servers As User Processes • Servers run at the same privilege level as user processes but at higher priority. • Q: What is the difference between the privilege and priority? Process management in Minix

  10. Server’s Characteristics • They start when the system starts. • They never terminate when the system is active. • To accommodate a new server the kernel must be recompiled. • The kernel startup code installs the servers in the higher priority slots of process table before any user processes are allowed to run. Process management in Minix

  11. Processes Management in Minix • All user processes in the system are descendants of a process called init. • The Minix boot program loads into memory: • the kernel • the memory nanager • the fisle syetm • and init (the first user process) Process management in Minix

  12. Init execution steps • Init executes the following steps: • reads the file /etc/ttytab to find all potential login terminals • forks off a child process for each terminal • each child executes usr/bin/getty which prints a message and waits for a name to be typed • usr/bin/login is called with the name as its argument • after a successful login /bin/login executes user’s shell specifies in etc/passwd file. Process management in Minix

  13. Interprocess Communication • Processes communicate in Minix via message passing. • Three primivites are provided for sending and receiving messages: • send (dest, &message) • receive(source, &message) • send_rec(src_dst, &message) Process management in Minix

  14. Send • send (dest, &message) • Is used to send a message to process dest. • The second parameter: &message is the address of the message data. Process management in Minix

  15. Receive • receive(source, &message) • Is used to receive a message from process source. • The second parameter: &message is the address of the message data to be received. Process management in Minix

  16. Send and Receive • send_rec(src_dst, &message) • Is used to send a message and wait for a reply form the same process. • The replay overwrites the original message. Process management in Minix

  17. Synchronous and Asynchronous Message Passing • When a process sends a message to a process that is not currently waiting to receive the message, the sender blocks until the destination does RECEIVE. • Q. WHY? • Q. What is the difference between synchronous and asynchronous message passing? Process management in Minix

  18. Process Scheduling in Minix • Minix uses multilevel queue scheduling algorithm. • There are three levels corresponding to layers 2, 3 and 4 of the Minix structure • Tasks and server processes run until they block (FCFS). • User processes use Round Robin with quantum 100 msec. Process management in Minix

  19. Minix Source Code Organization • Source code is organized in two directories: /usr/include and usr/src • /usr/include directory contain: • sys/ : contains additional POSIX headers • minix/: includes header files used by Minix • ibm/: includes header files with IBM PC specific definitions Process management in Minix

  20. Src/ directory • Scr/ directory contains: • kernel/ : layers 1 and 2 of Minix • mm/: the code for memory manager • fs/ : the code for the file system • lib/ : the source code for library procedures • tools/:the source code for the init program • boot/: the source code for booting and installing Minix. Process management in Minix

  21. Minix Executable • When Minix is compiled all source codes in src/kernel/, src/mm/ and src/fs/ are compiled to object files. All the object files in src/kernel/ are linked together to form a single executable program, kernel. The object files in src/mm/ and in src/fs/ are linked respectively to form mm and fs. Process management in Minix

  22. Process header files • src/kernel/kernel.h • defines macros _POSIX SOURCE, _MINIX. _SYSTEM • includes other header files • a lot of other files may share a large number of definitions by including kernel.h Process management in Minix

  23. const.h • contains a number of machine dependent values such as interrupt vectors • contains machine independent values such as priorities of scheduling queues. • type.h • defines several prototypes and structures used in any implementation of Minix and some machine dependent values Process management in Minix

  24. proto.h • all functions that must be know outside of of the file in which they are defined are in this file • glo.h • all kernel global variables are defined here Process management in Minix

  25. Proc.h • defines a process table entry as proc. • Defines process table as • proc[NR_TASKS+NR_PROCS] • Question: • What are the values of NR_TASK and NR_PROCS? • Look at include/minix/const.h and include/minic/config.h Process management in Minix

  26. protect.h • defines values very specific to the protected mode of the Intel Processor architectures. Process management in Minix

  27. How to Backup the Kernel • Login as bin • In bin’s home directory /usr/src do • cpdir kernel kernelBackup Process management in Minix

  28. How To Restore the Kernel • cpdir kernel_backup kernel • rm kernel/*.o • cd tools • make hdboot • shutdown Process management in Minix

  29. How to Compile the Kernel • Log in to as bin • Change directory totools • Run make hdboot Process management in Minix

  30. How to boot from an older (correct) version of Minix). • Use the “image” variable of the boot monitor. • For example: • hd1> image=minix/2.0.0 • hd1> boot • After correcting the problem and recompiling the kernel you may instruct the monitor to pick the most recent version by typing. • Hd1> unset image • hd1> boot Process management in Minix

More Related