06-18-2006
Sometimes a process needs something that is not available....a free disk buffer, some data from disk, or maybe just a signal. So it will go to sleep and wait for the resource to become available. This act of sleeping on a resource is what raises a process' priority to a kernel priority. But a sleeping process is not using a cpu. When the resource becomes available, the process will run at the elevated level, but, if the kernel is well written, this will be a very short time. Either it will sleep for something else or it will return to user mode. At return to user mode time, the priority is recalculated. Since the process recently spent time asleep, it will get credit for not hogging the cpu.
Thus very high priority processes tend to not be running and do not want the cpu. The quantum is based on cpu time, not elapsed time. But if the quantum were to be consumed while the process is in system mode, this will be detected upon the return to user mode.
But no matter how high the priority is, if another higher priority wants the cpu, the lower priority process will be preempted. You are getting confused with another issue. Unix guarantees that some system calls are atomic. To meet this guarantee, it has a concept of very high priority. The difference is a that a very high priority process will not wake up if a signal is sent to it. The signal will be pending until its priority lowers somewhat. If a process is writing to a disk file, it will not be signalable until the write completes. But if a process is writing to a tty, a signal can interrupt the write before it completes.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I want to know the interrupt passed to a process through 'ulimit'
I am running a process which gets killed when the 'ulimit -t' reaches.
But after killing the process I want to start another process which would
send a message or do some clean up or anything at all.
To do the same I am... (5 Replies)
Discussion started by: mrnuttynuts
5 Replies
2. UNIX for Dummies Questions & Answers
This is on our Ultra 5/10 Sparc with Solaris 9.
I need to store the following (stty) keys in the .profile and /etc/profile files as
shown here.
erase "Back Space Key"
Interrupt "Ctrl + C"
I need the exact syntax/procudure as I have to set these two keys whenever I login to the terminal... (1 Reply)
Discussion started by: chrs0302
1 Replies
3. Shell Programming and Scripting
Is it possible to sent a ^C interrupt via the command line? For example if I want to tail a log for 10 minutes at a time, kill the tail and then start it again is there a way to go about that? I would imagine there would be some way to do it by finding and killing the PID, but I'm curious if... (2 Replies)
Discussion started by: DeCoTwc
2 Replies
4. Shell Programming and Scripting
Hi All,
Is interrupt handling possible in k shell?
Say if the user press CTRL-C or CTRl-D,I want to perform a particular action before terminating?
Thnaks! (2 Replies)
Discussion started by: prasperl
2 Replies
5. UNIX for Advanced & Expert Users
Hi,
i have an rhel box with around 20 %soft every 2 seconds. The box is idle.
How do i start hunting down what's causing this? i believe /proc/interrupts is hardware related, procinfo is basically the same. where else can i look?
thanks,
Marc (5 Replies)
Discussion started by: marcpascual
5 Replies
6. UNIX for Advanced & Expert Users
I receive the following warning messages on a very new machine which has FreeBSD 8.1 x64 installed on it:
Interrupt storm detected on "irq 20" throttling interrupt source
It is unclear what this means and what its origins are (motherboard? CPU? RAM?).
I can start the desktop and the message is... (4 Replies)
Discussion started by: figaro
4 Replies
7. UNIX for Advanced & Expert Users
Hi, all:
Is there any shell command to show which interrupt handler handle which interrupt number in the system?
li,kunlun (5 Replies)
Discussion started by: liklstar
5 Replies
8. What is on Your Mind?
Hi Friends
any know how became a friend in this Android Programming Language (0 Replies)
Discussion started by: ljarun
0 Replies
9. Shell Programming and Scripting
Hello
i have problem passing ctrl+C into shell script
this script will run application and return value but never ends and stay running.
i tried trap and not working at all
the command should look like this :
sarm pcsp -s CHG_M_P1
i want something to stop this command after... (9 Replies)
Discussion started by: mogabr
9 Replies
10. UNIX for Advanced & Expert Users
The book The Design of the Unix Operating System speaks of a clock or timer that is used in scheduling. The clock generates interrupts that update priority information for processes and preempt processes in a round-robin fashion. It's apparent that this "clock" is not the same thing as the CPU... (1 Reply)
Discussion started by: Ultrix
1 Replies
LEARN ABOUT DEBIAN
moosex::role::timer
MooseX::Role::Timer(3pm) User Contributed Perl Documentation MooseX::Role::Timer(3pm)
NAME
MooseX::Role::Timer - Measure times with your object.
SYNOPSIS
package Demo;
use Moose; # or Any::Moose
with 'MooseX::Role::Timer';
sub BUILD {
shift->start_timer("build");
}
sub do_something {
my $self = shift;
$self->start_timer("something");
# do something...
$self->stop_timer("something");
}
package main;
my $demo = Demo->new;
$demo->do_something;
$demo->do_something;
printf "%3.6fs
", $demo->elapsed_timer("build"); # time spent since BUILD
printf "%3.6fs
", $demo->elapsed_timer("something"); # time spent in sub do_something
This Role provides your object with timers, making it easier to keep track of how long whatever actions take.
start_timer($name)
Start timer $name.
stop_timer($name)
Stop timer $name. Could be started again to cumulatively measure time.
reset_timer($name)
Stops timer $name and clears cumulated times for $name.
elapsed_timer('name')
Return the elapsed time in seconds (cumulated) for timer $name.
timer_names
Return all timer names.
AUTHOR
Michael Langner, "<mila at cpan.org>"
BUGS
Please report any bugs or feature requests to "bug-moosex-role-timer at rt.cpan.org", or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-Timer <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-Timer>. I
will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
COPYRIGHT & LICENSE
Copyright 2010 Michael Langner, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-05-02 MooseX::Role::Timer(3pm)