Sponsored Content
Top Forums UNIX for Advanced & Expert Users Can someone describe the process of pre-emption in UNIX? Post 302950317 by Corona688 on Thursday 23rd of July 2015 11:18:06 AM
Old 07-23-2015
fork() pre-empts -- just like any and every other system call pre-empts. The calling process is forced to stop during any system call, while the kernel executes instead. This does not mean the new process is guaranteed to start before the parent restarts, however. UNIX gives no guarantees of scheduling order unless you specifically ask for it.

UNIX scheduling is more complicated than round robin. You can set priorities. The 'nice' command is related to this, it lets you run a process at reduced priority.

How the scheduler itself is built varies because there's way more than one kind of UNIX, but it's often credit-based -- i.e. processes which "behave" are run preferentially before ones which "misbehave". A polite process pre-empts by itself, from waiting on I/O or calling sleep(), etc. An impolite job, such as a CPU-intensive physics simulation, almost never pre-empts by itself and gets demerits when the kernel must force pre-emption instead.

This allows the scheduler to automatically prioritize interactive processes -- where waits might be noticed -- above batch jobs, which care much less.

Last edited by Corona688; 07-23-2015 at 12:26 PM..
These 3 Users Gave Thanks to Corona688 For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

describe unix commands in english

the following unix command ls | grep'?cw1' | wc -l converting it to english is it going to be like list the result of the search '?cw1' in number of lines is that correct ? (4 Replies)
Discussion started by: props
4 Replies

2. UNIX for Dummies Questions & Answers

Describe what this line of code would do

I am confused about what this line of code would do. I understand all the pieces but not the final outcome. Anyone that could help? find / -type f -xdev -mtime 0 -size 100000 -exec ls -lht {} /; 2>/dev/null (4 Replies)
Discussion started by: NickNine
4 Replies

3. Solaris

Describe the parameters of iostat,vmstat and mpstat

Hi, I am trying to take the Statistics of the machine during load.Can someone explian the parameters of iostat: tty sd1 sd2 sd3 sd4 cpu tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id vmstat: kthr ... (1 Reply)
Discussion started by: grrajeish
1 Replies

4. Shell Programming and Scripting

I'm not sure how I would describe this

Some software, when you install it, prompts you for variables, such as the username for the software, or the password you are setting for the software's root account. I would like to know if it is possible to do such a thing, and if yes, how? basically, I would like my installer script to prompt... (3 Replies)
Discussion started by: Bakes
3 Replies

5. Shell Programming and Scripting

special question, hard to describe in few words...

dear coders, i need some inspiration again... there is something what i always wanted to know... how to code following: value 1: __________ value 2: __________ important: when my "script" starts the display has to be cleared and two lines are shown (see above), the cursor has to be... (2 Replies)
Discussion started by: pseudocoder
2 Replies

6. UNIX for Advanced & Expert Users

DEscribe this command

Hi all. can you please tell me (root) NOPASSWD: ALL what this command means (1 Reply)
Discussion started by: mindtee_abhi
1 Replies

7. Solaris

can someone describe

What is openboot prompt is this some kind of shell , and where is located :p (2 Replies)
Discussion started by: solaris_user
2 Replies

8. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

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

9. Shell Programming and Scripting

please describe me some simple command

Hi everyone I'm new here and I don't know some command of unix, please help by describe me how it work, I study unix command by myself and can't search exactly means so...Thanks :D sqlplus -s /nolog @${SQLFILE} ${file_type} >> ${OUTPUT_FILE} date "+%Y%m%d%H%M%S" $/usr/bin/echo "INFO : $1"... (2 Replies)
Discussion started by: zound617
2 Replies
SCHED_SETSCHEDULER(2)					      BSD System Calls Manual					     SCHED_SETSCHEDULER(2)

NAME
sched_setscheduler, sched_getscheduler -- set/get scheduling policy and scheduler parameters LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sched.h> int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param); int sched_getscheduler(pid_t pid); DESCRIPTION
The sched_setscheduler() system call sets the scheduling policy and scheduling parameters of the process specified by pid to policy and the parameters specified in the sched_param structure pointed to by param, respectively. The value of the sched_priority member in the param structure must be any integer within the inclusive priority range for the scheduling policy specified by policy. In this implementation, if the value of pid is negative the system call will fail. If a process specified by pid exists and if the calling process has permission, the scheduling policy and scheduling parameters will be set for the process whose process ID is equal to pid. If pid is zero, the scheduling policy and scheduling parameters are set for the calling process. In this implementation, the policy of when a process can affect the scheduling parameters of another process is specified in IEEE Std 1003.1b-1993 (``POSIX.1'') as a write-style operation. The scheduling policies are in <sched.h>: [SCHED_FIFO] First-in-first-out fixed priority scheduling with no round robin scheduling; [SCHED_OTHER] The standard time sharing scheduler; [SCHED_RR] Round-robin scheduling across same priority processes. The sched_param structure is defined in <sched.h>: struct sched_param { int sched_priority; /* scheduling priority */ }; The sched_getscheduler() system call returns the scheduling policy of the process specified by pid. If a process specified by pid exists and if the calling process has permission, the scheduling parameters for the process whose process ID is equal to pid are returned. In this implementation, the policy of when a process can obtain the scheduling parameters of another process are detailed in IEEE Std 1003.1b-1993 (``POSIX.1'') as a read-style operation. If pid is zero, the scheduling parameters for the calling process will be returned. In this implementation, the sched_getscheduler system call will fail if pid is negative. RETURN VALUES
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
On failure errno will be set to the corresponding value: [ENOSYS] The system is not configured to support this functionality. [EPERM] The requesting process doesn not have permission as detailed in IEEE Std 1003.1b-1993 (``POSIX.1''). [ESRCH] No process can be found corresponding to that specified by pid. [EINVAL] The value of the policy argument is invalid, or one or more of the parameters contained in param is outside the valid range for the specified scheduling policy. SEE ALSO
sched_get_priority_max(2), sched_get_priority_min(2), sched_getparam(2), sched_rr_get_interval(2), sched_setparam(2), sched_yield(2) STANDARDS
The sched_setscheduler() and sched_getscheduler() system calls conform to IEEE Std 1003.1b-1993 (``POSIX.1''). BSD
March 12, 1998 BSD
All times are GMT -4. The time now is 05:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy