02-21-2012
Unix process states
I am trying to write my own Unix compliant (SUSv4) OS - Just a hobby OS, nothing serious. While going through the standard, I couldn't find any explicit information on process states. What I could find was (excluding the real-time considerations)-
Quote:
# 3.444 Zombie Process
A process that has terminated and that is deleted when its exit status has been reported to another process which is waiting for that process to terminate.
#4.1.4 Scheduling Policy
A scheduling policy affects process or thread ordering:
- When a process or thread is a running thread and it becomes a blocked thread
- When a process or thread is a running thread and it becomes a preempted thread
- When a process or thread is a blocked thread and it becomes a runnable thread
- When a running thread calls a function that can change the priority or scheduling policy of a process or thread
- In other scheduling policy-defined circumstances
From this it can be inferred that the following process states might exist-
RUNNING, BLOCKED, PREEMPTED, RUNNABLE, ZOMBIE
I was wondering whether the Unix specification gives something more detailed?
If not, does any implementation of the above criteria meet the specification? Or is there something more?
8 More Discussions You Might Find Interesting
1. IP Networking
Ok, I've read the manpages on netstat and it gives a good description of the state values such as CLOSE_WAIT, ESTABLISHED, SYN_RECEIVED, etc..
Can someone give me real world situations where you would get these states. LIke for example if I got SYN_RECEIVED what possible situations would be the... (1 Reply)
Discussion started by: eloquent99
1 Replies
2. Programming
Hi,
i need to find the process name using the process id in C. This has to be done in HP, AIX, Solaris & Linux??
How can this be done? Is there any common solution to all platforms?
On linux i have heard that /proc/<pid>/cmdline can be used. Is there a structure available to read this?
... (3 Replies)
Discussion started by: molu
3 Replies
3. Solaris
Hi Everybody,
As I am new to Sun Clusters, Please help me what is "online but not monitored" state of resources and "online - service is online" in status message. Thank you. (1 Reply)
Discussion started by: mayahari
1 Replies
4. Shell Programming and Scripting
Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it
This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies
5. UNIX and Linux Applications
Hi guys,
Can you help me please to find an appropriate course of UNIX in the United States.
Also, can you provide me some information about the schools or institutes that offer it in the U.S.
Thanks, (0 Replies)
Discussion started by: Malik Dera
0 Replies
6. Shell Programming and Scripting
netstat | awk '/server/ {for(i=1;i<2;i++) {getline;print}'
Output:
ESTABLISHED
ESTABLISHED
ESTABLISHED
ESTABLISHED
ESTABLISHED
TIME_WAIT
TIME_WAIT
From the above command I'm getting all the states. I want to count the states and write to a file, like
"Count of ESTABLISHED... (6 Replies)
Discussion started by: Roozo
6 Replies
7. Hardware
turbostat reports C-states of all CPU cores, and includes entries for each hyper-threaded core as well. Often enough the two logical cores on a single physical core will list different C state percentages. Does that make any sense?
Is this reporting the c-states of the few duplicated parts... (8 Replies)
Discussion started by: agentrnge
8 Replies
8. Shell Programming and Scripting
I am using HP-UX,KSH
$ jobs -l
+ 19377 Running nohup ksh cat_Duplicate_Records_Removal.ksh </dev/null >/dev/null 2>&1 &
$ ps -p 19377 -fl
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME COMD
401 S catmgr 19377 19491 ... (1 Reply)
Discussion started by: TomG
1 Replies
LEARN ABOUT SUNOS
pthread_getschedparam
pthread_getschedparam(3C) pthread_getschedparam(3C)
NAME
pthread_getschedparam, pthread_setschedparam - access dynamic thread scheduling parameters
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include <pthread.h>
int pthread_getschedparam(pthread_t thread, int *restrict policy, struct sched_param *restrict param);
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param);
The pthread_getschedparam() and pthread_setschedparam() functions allow the scheduling policy and scheduling parameters of individual
threads within a multithreaded process to be retrieved and set. Supported policies are SCHED_FIFO, SCHED_RR, and SCHED_OTHER. See
pthreads(5). For SCHED_FIFO, SCHED_RR, and SCHED_OTHER, the affected scheduling parameter is the sched_priority member of the sched_param
structure.
The pthread_getschedparam() function retrieves the scheduling policy and scheduling parameters for the thread whose thread ID is given by
thread and stores those values in policy and param, respectively. The priority value returned from pthread_getschedparam() is the value
specified by the most recent pthread_setschedparam() or pthread_create() call affecting the target thread, and reflects any temporary
adjustments to its priority as a result of any priority inheritance or ceiling functions. The pthread_setschedparam() function sets the
scheduling policy and associated scheduling parameters for the thread whose thread ID is given by thread to the policy and associated
parameters provided in policy and param, respectively.
If the pthread_setschedparam() function fails, no scheduling parameters will be changed for the target thread.
If successful, the pthread_getschedparam() and pthread_setschedparam() functions return 0. Otherwise, an error number is returned to indi-
cate the error.
The pthread_getschedparam() function may fail if:
ESRCH The value specified by thread does not refer to a existing thread.
The pthread_setschedparam() function may fail if:
EINVAL The value specified by policy or one of the scheduling parameters associated with the scheduling policy policy is invalid.
EPERM The caller does not have the appropriate permission to set either the scheduling parameters or the scheduling policy of the
specified thread.
ESRCH The value specified by thread does not refer to a existing thread.
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
pthread_attr_init(3C), sched_getparam(3RT), sched_setparam(3RT), sched_getscheduler(3RT), sched_setscheduler(3RT), attributes(5),
pthreads(5), standards(5)
23 Nov 2005 pthread_getschedparam(3C)