9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] setitimer equivalent, and sigvtalarm equivalent
Date: Sat,  2 May 2015 08:06:56 -0700	[thread overview]
Message-ID: <327906ef0db2d363fc57be34bfe82774@brasstown.quanstro.net> (raw)
In-Reply-To: <32E4BD35-FCDC-4859-9034-82747001C411@gmail.com>

> I’m not sure I understand your proposal.
> 
> But looking more at the code I need to port, an interpreter, I think
> the main issue is that the interpreter relies on sigvtalarm as
> a way to preempt the interpreted program while allowing
> the user program to use only sigalarm. So more generally
> the problem is how can I have two alarms in plan9? I see only
> one alarm signal in ape, SIGALRM. There is no SIGVTALRM.

the standard way to do this is as the kernel does.  the kernel typically
keeps one highres timer (per core), and a linked list of events sorted by alarm
time.  when the alarm fires, do the action associated with each alarm that has
passed and reload periodic timers.  this is in port/portclock.c.  i'm sure there
are implementations of this algorithm elsewhere, too.

- erik



  parent reply	other threads:[~2015-05-02 15:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29  4:28 [9fans] setitimer equivalent yoann padioleau
2015-04-29  4:38 ` James A. Robinson
2015-04-29  4:55   ` lucio
2015-04-29  5:19     ` James A. Robinson
2015-04-29  6:38       ` lucio
2015-04-29 16:47 ` erik quanstrom
2015-05-01  3:21   ` [9fans] setitimer equivalent, and sigvtalarm equivalent yoann padioleau
2015-05-01  7:17     ` Skip Tavakkolian
2015-05-02 15:06     ` erik quanstrom [this message]
2015-05-02 15:27       ` cinap_lenrek
2015-05-02 18:01       ` yoann padioleau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=327906ef0db2d363fc57be34bfe82774@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).