teacher's notes - lab chapter 4 - solaris process
TRANSCRIPT
-
7/25/2019 Teacher's Notes - Lab Chapter 4 - Solaris Process
1/4
J.E.D.I.
1 Solaris Process
1.1 ObjectivesThis chapter shows how a process is implemented in Solaris.
1.2 Chapter Outline Introduction
Components of a process
Process Structure
1.3 IntroductionA process can be defined as a program in execution. As we discussed in our lecture class
programs exist merel! as instructions in a file until the! are run b! the CP". #hen a programis run the instructions are loaded into main memor! and thus becomes a process. This chapter
discusses how Solaris implements processes.
1.4 Components of a ProcessThe Solaris process follows our definition of a process. The operating s!stem must $eep trac$of multiple processes coming from a user together with processes from other users at the
same time. Each Solaris process is gi%en a process id &PID'. A list of processes is stored in the
process table. The process table can be %iewed with the ps command.
# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 0 0 0 Nov 20 ? 0:11 sched
root 1 0 0 Nov 20 ? 0:02 /s!"/!"!t
root 2 0 0 Nov 20 ? 0:00 p$eo%t
root & 0 0 Nov 20 ? 11:0' fsf(%sh
root 21' 1 0 Nov 20 ? 0:00 /%sr/s!"/cro"
root ) 1 0 Nov 20 ? 0:1& /(!/svc/!"/svc*strtd
root + 1 0 Nov 20 ? 0:2, /(!/svc/!"/svc*co"f!$d
root 12 1 0 Nov 20 ? 0:2. /%sr/s!"/"scd
root 101 1 0 Nov 20 ? 0:00 /%sr/(!/s"p/s"pd - -c
/etc/s"p/co"f
root 1,0 1,&. 0 22:1):&0 pts/2 0:00 sh
A process can consist of multiple user threads. A thread is a line of code execution runninginside a process. A traditional process &such as a basic C or Ja%a program' would ha%e a single
thread running. (ut a Solaris process can support more than one thread running at the sametime. #e will discuss how to program multithreaded applications in a later chapter.
Each user thread is associated b! the Solaris $ernel with a )ight #eight Process or )#P. An)#P allows each user thread to access $ernel functions independentl! of other threads.
Each )#P is executed b! a $ernel thread. The $ernel thread is the unit of s!nchroni*ation inSolaris. In essence user threads though the )#P construct are executed b! $ernel threads.To increase thread startup time the $ernel $eeps idle $ernel threads read! to accept )#Ps
whene%er a new user thread starts running.
+perating S!stems ,
-
7/25/2019 Teacher's Notes - Lab Chapter 4 - Solaris Process
2/4
J.E.D.I.
+perating S!stems -
-
7/25/2019 Teacher's Notes - Lab Chapter 4 - Solaris Process
3/4
J.E.D.I.
1.5 Process Structure
Solaris stores information about each process in the s!stem. The information stored is
summari*ed b! the following figure. #e will discuss each field in this section.
Source file information This field contains information on the executable file of this
process.
/emor! information Indicates the memor! pages where the process resides.
Process famil! tree pointer to the process that created this process &parent process'
or to child processes that this process has created.
Credentials indicates the user id and group id of the user that started the process.
This could be used to chec$ against the securit! polic! of the s!stem.
CP" "tili*ation fields that $eep trac$ of the time the process runs either in the usualuser mode or running a $ernel function in $ernel mode.
Session processes are also grouped b! sessions for example which processes belong
to which user terminals. This field is used to store information about the originatingsession this process belongs to.
PID each process is gi%en a uni0ue process id number in the s!stem.
Signal support signals are a wa! a process can be informed of a particular e%ent for
example when the s!stem is going to be shut down. This is a pointer to a structure
that indicates how signals are to be handled.
+pen file list list of files that the process is currentl! using.
1proc support processes are represented in the file s!stem as files in the director!
+perating S!stems 2
-
7/25/2019 Teacher's Notes - Lab Chapter 4 - Solaris Process
4/4
J.E.D.I.
1proc with the process file name as the process ID.
Process thread list a pointer to a structure that maintains the list of user threads that
ma$e up the process.
Profiling information stores beha%ioral information about the process such as
microstate accounting &low3le%el process state trac$ing' resource usage information.
4esource information stores information on which resources are used b! the process
and what resources are made a%ailable to the process.
+perating S!stems 5