5 Pages

processes

Course: CIT 370, Fall 2009
School: W. Kentucky
Rating:
 
 
 
 
 

Word Count: 3376

Document Preview

Administration System Course Notes Processes The term process, when discussion operating systems, is used to describe a program in the state of execution. That is, it is a program that has begun execution but has not completed. The reason that we differentiate between a program and a process is that a program is a passive entity it is a body of code. But a process includes a state: the values of the various data...

Register Now

Unformatted Document Excerpt

Coursehero >> Kentucky >> W. Kentucky >> CIT 370

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Administration System Course Notes Processes The term process, when discussion operating systems, is used to describe a program in the state of execution. That is, it is a program that has begun execution but has not completed. The reason that we differentiate between a program and a process is that a program is a passive entity it is a body of code. But a process includes a state: the values of the various data at the moment, the process status (executing, sleeping, waiting, suspended), and the resources currently issued to that process. This set of notes concentrates on processes, their various states and terminology that you might need to know about processes. Starting a Process In most operating systems, starting a process is a matter of double clicking on the appropriate short cut icon or selecting the programs name from a menu. As you have seen in Linux, you can also start a process from the command line. The shortcut approach in a GUI (menu or double clicking) is merely a convenience because, upon selecting the program, the OS translates your mouse action into a call to start the program, similarly to the command line approach. If you take a look at the shortcuts in the Windows environment (select Properties from the right button menu) you will see the actual command that executes. From the command line however, you can provide parameters which are not available from the GUI. For instance, you might type emacs foobar.txt rather than just start emacs. Or, you can supply any number of parameters in such commands as ls or useradd. Once you have issued your command to start a program, the OS takes over. First, it must locate the executable code stored somewhere on the hard disk. Next, it must load the executable code onto the swap space and copy a portion of the executable code (usually the first few pages) into memory. It creates a process ID and a data structure that describes the process status and inserts it into a queue. Queues are described below. The processor will eventually get to the process and begin executing it. This may be immediate, or it may take a few milliseconds depending on what other processes are being executed at the time. Process Execution Once started, the process is added to a list of processes that need CPU and OS attention. Depending on the type of operating system, the process may start executing immediately or be forced to wait. The various ways that OSs will execute programs is: Single tasking Batch Multiprogramming Multitasking Multithreaded A single tasking system, the oldest and simplest, merely executes one program until it concludes and then switches back to the OS to wait for the user to request another program to execute. MS-DOS was such an OS. All programs are executed in the order that they were requested. A batch processing system is similar to a single tasking system except that there is a queue (waiting line) for processes. Users submit their program to the OS, the OS adds the process to a queue. When the processor finishes with one process, the OS is invoked to decide which of the waiting processes to bring to the CPU next. Some form of scheduling is needed to decide which process gets selected next, including a priority scheme (processes are given priorities depending on the users who submitted them, for instance administration processes would have the highest priority, faculty and staff next and students last), shortest job first, and first come first serve. A multiprogramming system is similar to a batch system except that, if the current process requires I/O (which is time consuming), then it is moved to another queue (an I/O waiting queue) and the OS selects another process to begin (or resume). When the original process finishes with its I/O, it is resumed and the current process is moved back into a queue. This leads to a distinction in queues. There is the ready queue (the queue of processes waiting for the CPU, these processes have already been moved into memory and/or swap space), I/O queues (one for each I/O device), and the waiting queue (the queue of processes that have been requested to be run, but have not yet been moved into the ready queue). Multiprogramming is more efficient than simple batch processing because the processor never has to wait for I/O as long as there are other processes around to run. Multitasking takes the idea of multiprogramming one step further. In multiprogramming, a process is only suspended (forced to wait) when it needs I/O, thus causing the CPU to switch to another process. But in multitasking, a timer is used to count the number of clock cycles that has elapsed since this process began. After a preset number of cycles, the timer interrupts the CPU to force it to switch to another process. The suspending process gets moved to the back of the ready queue and must wait its turn. Because modern processors are so fast, the user would not tend to notice that the running process has been moved to the ready queue because it would be moved back to the CPU within a few milliseconds time. Note that an older version of multitasking was called time sharing. The idea of switching processes is known as a context switch (the processor is switching its context). During a context switch, the processor is idle (because the process being resumed needs to have its important information restored into memory and registers). In order to make this efficient, computer hardware supports the process. The extra hardware includes registers and a run-time stack in memory. Today, processes can contain multiple running parts, called threads. For instance, you might run Mozilla but have several open tabs or windows. You are running a single process but several instances of the process. The only difference between each process is its data (window 1 is open to one URL, window 2 is open to another, the URLs and the data displayed are different, but the program code is the same). A multithreaded OS is the same as a multitasking OS except that the CPU switches off between threads of a single process and between different processes. Some additional terms related to the execution of processes are: Thread a portion of a process Process status the current run-time status of the process which includes what its state is (running, ready, suspended, waiting for I/O, terminated), where it is currently at (which queue or in the CPU), and the value of the program counter which describe what instruction is the next to be executed, and other information. Run-time stack the OS maintains a stack of processes so that it can resume another process when needed Queue waiting lines, there are usually several maintained by the OS including the ready queue, the waiting queue and I/O queues. Scheduling an algorithm which selects the next process or thread to resume when the timer elapses or the CPU becomes available. First come first serve is common today. Synchronization when two or more processes need to communicate with each other, perhaps by passing data between them. It is critical to make sure that this is done properly or else data can become corrupted. Foreground the current running process. In a windows environment, it is the active window (denoted by a title bar of a different color than other windows and a pressed tab at the bottom of the screen) Background processes that have been started but are currently waiting for attention or for the user to select them. In a multitasking environment, we are used to having multiple processes run at the same time (in fact, they are not executing simultaneously, instead, the CPU executes a few hundred instructions on one process and then moves onto the next, and then the next, and eventually returns to the first one, over and over. The CPU is so quick at this that we dont notice that any given process isnt getting full attention). There are times, however, when we want to specify which process should have the CPUs attention or should be the process that receives user input. Process Status A process status is information about the process, for instance, what state it is in, what resources it is using, what its process ID is (PID in Linux). To obtain information about a process, you can use ps. This provides the process status for all active processes. Using ps by itself shows you the active processes in the current window owned by you. Using ps aux gives you all active processes by all users. Note that older versions of Unix required a for parameters (as in ps aux) but the is largely omitted these days. Using ps axf gives you the processes in the shape of a tree to show you which processes spawned other processes. For instance, from bash you might type emacs and from emacs you might issue another command (say to compile the current file), thus bash is the parent of emacs is the parent of the compile command. The ps command, when supplied with the parameter u gives a long listing of information which includes for each process, the processs owner, the PID, CPU usage, memory usage, terminal from which the command was issued, current process status, start time and amount of CPU time that has elapsed. Note that since ps aux will give you a list of all active processes, you might want to pipe the output to grep to list only specific processes, such as your processes by doing aux ps | grep username. The PID is particularly useful for issuing other commands including kill (covered later in these notes). Another command to obtain status information is top. While ps provides a snapshop of what is going on at the time you issue the command, top is interactive in that it updates itself and displays the most recent information, usually every 3 seconds. Because top is interactive, it remains in the window and so you do not have access to the command line prompt while it is executing. Also different between ps and top is that top only lists the processes that are most active at the moment. There are a number of parameters however that can allow you to change what top displays. For the most part, unless you are trying to work with the efficiency of your system, you will find ps to be easier and more helpful to use. To exit from top, type ctrl+c. In a Windowing environment, you can select the foreground process by clicking on the window containing that process, or clicking on the tab at the bottom of the screen to bring the window up. Other processes might move to the background, meaning that they are not executed, or that they are executed only when the CPU has time to spend on them. In Linux, we can have multiple processes running in a single terminal window. We specify which process is in the foreground and which are in the background. To move a running process to the background, use control-z to suspend it. To see what processes are currently active in the window, type jobs. To move a process to the foreground, type fg jobnumber where the job number is given when you type jobs (or just fg if it is the only active process in the terminal window). The command bg jobnumber will move a job to the background. Note that the job number differs from the PID and you do not use the PID for fg or bg. Another idea is of processes spawning (starting) other processes. For instance, mozilla may spawn a print process (lp). There are two ways that a process can spawn another. The first is to issue the process initiation command and wait for the process to execute and terminate before resuming. This can be performed in Linux using the exec command. However, the original process may not want to wait (for instance, would you want to wait until the print job finished before you were able to regain control of your mozilla browser?) in which case the process instead forks the subprocess. Now both processes can run independently. To fork a process in Linux, use &. This is commonly done at the command prompt you are already in bash and wish to start a new process. If you type a process like rm or awk, the program (rm or awk) runs to completion and then you get control of your bash shell again. If you want to run a lengthier program while continuing to use your shell, you would issue the command and follow it with &, as in emacs & which will start an emacs buffer outside of the current window. In Linux, you can also specify the priority of a process by using the nice command. Nice means to make the process nicer, or to let it share the CPU more readily. The form of nice is nice process-name n value where value is between -20 (lowest priority and 19 (highest). Process Scheduling Aside from the OS selecting a process (scheduling), you can also determine when a process should be initiated. In Linux, there are three approaches, at, batch and cron. The at program allows you to specify when a given process should begin execution. You may either specify a program in your at command, or you may issue a list of commands to execute at the at prompt. The former approach is easier although requires that you add f in the command. For instance, you might write a shell script which searches through directories and finds any files that are improperly protected such as 777 or 000 and alter their permissions or make a list of those files and users. You want to run this program at 2 am when the system is not being used heavily. You write your shell script and issue the at command now, but the script does not execute until the time you set in your at command. There are multiple ways to specify the time when the command should execute. Among these include now (execute immediately), now + n (execute in n minutes), now + n hours (execute in n hours), at time (where time is a time of day such as at 10am to execute the next time it is 10 am, or a time of day and day of year as in 10am Mar 1). There are other options for specifying time as well (see the textbook and ats man page). At commands can only be issued by the system administrator or by a user whose name has been added to the file /etc/at.allow (this file can only be edited by the system administrator, so the sysadmin has the ability to extend the use of at to others). There is also a /etc/at.deny file. At works by using an at daemon (atd). The at daemon runs in the background on the system all of the time and occasionally (once per second) looks to see if any waiting at jobs time has been reached. A variation of at is batch. Batch does the same thing as at in terms of allowing a user (sysadmin) to execute a process later, but there is no time specified. Instead, the process executes once the systems load (CPU utility) drops below 1.5 (or a value specified by the at daemon). In order to see all pending at and batch jobs, use atq and to delete an at or batch job from the queue, use atrm followed by the number of the job in the queue. The third form of scheduling processes is to you crontab on a cron job. cron is the name of the daemon used by crontab. A cron job ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

W. Kentucky - CIT - 370
SYLLABUS FALL SEMESTER 2008CIT 370-002 System AdministrationINSTRUCTOR: OFFICE: PHONE: EMAIL: WEB PAGE: Dr. Charles E. Frank ST 311 (859) 572-5320 (office) frank@nku.edu http:/www.nku.edu/~frank/cit370f2008.htmlOFFICE HOURS: MWF 10:00 A.M. 10:5
W. Kentucky - CIT - 370
System Administration Booting, Initialization, and ServicesHere, we examine the boot process, initializing the operating system through shell scripts, and services started and how to start and stop services. We also discuss some of the more common s
W. Kentucky - CIT - 370
SYLLABUS SPRING SEMESTER 2005CIT 370-001 Operating Systems TechnologyINSTRUCTOR: OFFICE: PHONE: EMAIL: WEB PAGE: OFFICE HOURS: Dr. Charles E. Frank ST 311 (859) 572-5320 (office) frank@nku.edu http:/www.nku.edu/~frank/370sp2005.html TR 10:45 A.M.
W. Kentucky - CIT - 380
SYLLABUS FALL SEMESTER 2008 CIT 380-001 Securing Computer SystemsINSTRUCTOR: OFFICE: PHONE: EMAIL: WEB PAGE: Dr. Charles E. Frank ST 311 (859) 572-5320 (office) frank@nku.edu http:/www.nku.edu/~frank/cit380Fall2008.htmlOFFICE HOURS: MWF 10:00 A.M.
W. Kentucky - CIT - 140
SYLLABUS SPRINGSEMESTER2008CIT140002 IntroductiontoComputerInformationTechnologyINSTRUCTOR: OFFICE: PHONE: EMAIL: WEBPAGE: OFFICEHOURS: Dr.CharlesE.Frank ST311 (859)5725320(office) frank@nku.edu http:/www.nku.edu/~frank/cit140sp2008.html TR 12:30P
W. Kentucky - CIT - 141
SYLLABUS SPRING SEMESTER 2009CIT 141-002 PC/Networking FundamentalsINSTRUCTOR: OFFICE: PHONE: EMAIL: WEB PAGE: Dr. Charles E. Frank ST 311 (859) 572-5320 (office) frank@nku.edu http:/www.nku.edu/~frank/cit141sp2009.htmlOFFICE HOURS:W 10:00 A.M
W. Kentucky - CIT - 520
SYLLABUS SPRING SEMESTER 2007CIT 520-001 Managing Computer SystemsINSTRUCTOR: OFFICE: PHONE: EMAIL: WEB PAGE: OFFICE HOURS: Dr. Charles E. Frank ST 311 (859) 572-5320 (office) frank@nku.edu http:/www.nku.edu/~frank/520sp2007.html MWF 10:00 A.M. 1
W. Kentucky - CIT - 520
SYLLABUS FALLSEMESTER2007CIT520001ManagingComputerSystemsINSTRUCTOR: OFFICE: PHONE: EMAIL: WEBPAGE: OFFICEHOURS: Dr.CharlesE.Frank ST311 (859)5725320(office) frank@nku.edu http:/www.nku.edu/~frank/cit520f2007.html TR 11:00A.M. 12:00P.M. T 4:00P.M
W. Kentucky - CSC - 382
Name _ Assignment 14 Netsky Worm CSC 382/582Fall 2006 Use an Internet search engine to find information about the Netsky worm. Write a couple of paragraphs about this worm. How does it attack? What damage does it do? How many variation of Netsky ar
W. Kentucky - CIT - 140
SYLLABUS FALLSEMESTER2007CIT140002 IntroductiontoComputerInformationTechnologyINSTRUCTOR: OFFICE: PHONE: EMAIL: WEBPAGE: OFFICEHOURS: Dr.CharlesE.Frank ST311 (859)5725320(office) frank@nku.edu http:/www.nku.edu/~frank/cit140f2007.html TR 11:00A.M.
W. Kentucky - CIT - 380
Shoplifting is an ongoing problem for retail stores. Assume you are a manager of a clothing store. 1) Describe three measures you would take to prevent or detect shoplifting. 2) What are the costs of your security measures both to you and to your cus
W. Kentucky - CIT - 370
SYLLABUS FALL SEMESTER 2006 CIT 370-001 Operating Systems TechnologyINSTRUCTOR: OFFICE: PHONE: EMAIL: WEB PAGE: OFFICE HOURS: Dr. Charles E. Frank ST 311 (859) 572-5320 (office) frank@nku.edu http:/www.nku.edu/~frank/370f2006.html MWF 10:00 A.M. 10
W. Kentucky - CIT - 370
SYLLABUS FALL SEMESTER 2005CIT 370-001 Operating Systems TechnologyINSTRUCTOR: OFFICE: PHONE: EMAIL: WEB PAGE: OFFICE HOURS: Dr. Charles E. Frank ST 311 (859) 572-5320 (office) frank@nku.edu http:/www.nku.edu/~frank/370f2005.html MW 5:00 P.M. 6:0
W. Kentucky - CIT - 370
Page 214 #!/usr/bin/perl -w # whereis.pl use strict; my $prog = shift @ARGV; die "usage: perl whereis.pl <file>" unless defined $prog; my $found = 0; foreach my $dir (split /:/, $ENV{PATH}) { if (-x "$dir/$prog") { print "$dir/$prog\n"; $found = 1; l
W. Kentucky - CIT - 370
Name _ Laboratory 8 CIT 370-001 Fall 2006Create a new user account. Log in as root. Applications | Software Settings | Users and Groups Follow the steps on pages 726-7. See also Figures 29-2 and 29-3. Open a Terminal Window. #cat /etc/passwd My acco
W. Kentucky - CIT - 370
OperatingSystemsTechnology CourseNotes BasicLinuxCommandsManyofthebasicLinuxcommandsdealwithnavigatingtheLinuxfilespaceandhandlingfiles anddirectoriesinthefilespace. File a unit of storage that might contain data for a program to access, or it migh
W. Kentucky - READINGTHE - 2006
Northern Kentucky UniversityCollege of Education & Human ServicesSelected Topics in EducationReading the Licking River EDG 693-071 Summer 2006"Providing for the educational needs of all students" The teacher as reflective decision maker is the
W. Kentucky - INF - 286
WebDevelopment&Design FoundationswithXHTMLChapter3 KeyConceptsInthischapter,youwilllearnto: Learning OutcomesDescribetheevolutionofstylesheets fromprintmediatotheWeb ListadvantagesofusingCascadingStyleSheets UsecoloronWebpages Creat
W. Kentucky - CSC - 262
CSC 262.002 Programming Assignment #6 Queues and SimulationDue Date: Tuesday, March 19In this assignment, you are to create a Queue to be used in a bank simulation. The simulation will determine how many tellers the bank should have available dur
W. Kentucky - AWARDS - 2009
CALL FOR NOMINATIONS PART-TIME FACULTY EXCELLENCE IN INSTRUCTION AWARD PURPOSE:To recognize and reward excellence in classroom instruction and contributions to the learning environment by part-time faculty members.ELIGIBILITY:Nominees must: Have
W. Kentucky - CH - 18
"Biomira","TSE Index"-.11627906976744186,-.023314364545611328.059210526315789616,.04166091499252457.12422360248447203,.027903618738742718-.0055248618784531165,.05496693946224383-.12222222222222218,.06944871498686156-.1582278481012658,-.01512393
W. Kentucky - CH - 212
"Biomira","TSE Index"-.11627906976744186,-.023314364545611328.059210526315789616,.04166091499252457.12422360248447203,.027903618738742718-.0055248618784531165,.05496693946224383-.12222222222222218,.06944871498686156-.1582278481012658,-.01512393
Columbia - JM - 3058
SOLITON SPLITTING BY EXTERNAL DELTA POTENTIALSJUSTIN HOLMER, JEREMY MARZUOLA, AND MACIEJ ZWORSKI Abstract. We show that a soliton scattered by an external delta potential splits into two solitons and a radiation term. Theoretical analysis gives the
W. Kentucky - WATERSM - 1
Math 141Learning ObjectivesMusser, Burger, and PetersonChapter 12 Geometric Shapes Section 12.1 Students will be able to: Give analytical descriptions of various types of triangles, quadrilaterals and other polygons and their parts. List seve
W. Kentucky - ISSUE - 1
FryInvestigating the link between the dinoflagellate Amyloodinium sp.? and marine head and lateral line erosion (MHLLE) on Zebrasoma scopas (brown sailfin tangs)Michelle Ann FryFaculty Mentors: Denice Robertson, PhD (CINSAM/Department of Biologic
W. Kentucky - MAT - 225
Click to download data.Adjacency MatricesText Reference: Section 2.1, p. 114The purpose of this set of exercises is to show how powers of a matrix may be used to investigate graphs. Special attention is paid to airline route maps as examples of
W. Kentucky - MAT - 225
You can also view this case study in the following formats:MathematicaMapleMATLABHP 48GDiet ProblemsText Reference: Section 1.10, p. 93 The purpose of this set of exercises is to provide examples of vector equations which result from balan
W. Kentucky - MAT - 225
W. Kentucky - MAT - 360
W. Kentucky - MAT - 360
W. Kentucky - MAT - 360