From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) From: yoann padioleau In-Reply-To: <327906ef0db2d363fc57be34bfe82774@brasstown.quanstro.net> Date: Sat, 2 May 2015 11:01:11 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <4A54E518-87FB-4F82-84AA-BDCBD4DB0956@gmail.com> <32E4BD35-FCDC-4859-9034-82747001C411@gmail.com> <327906ef0db2d363fc57be34bfe82774@brasstown.quanstro.net> To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] setitimer equivalent, and sigvtalarm equivalent Topicbox-Message-UUID: 4ec61dbe-ead9-11e9-9d60-3106f5b1d025 Hi, Yes I think you=E2=80=99re right. Indeed the machine has one timer interrupt and it=E2=80=99s enough for the kernel to demultiplex it over many processes who each can have different alarm requirments. Thx. > On May 2, 2015, at 8:06 AM, erik quanstrom = wrote: >=20 >> I=E2=80=99m not sure I understand your proposal. >>=20 >> 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. >=20 > 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. >=20 > - erik >=20