9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Jan Hubicka hubicka@horac.ta.jcu.cz
Subject: [9fans] Porting XaoS (saga continues)
Date: Tue,  9 Sep 1997 10:28:24 +0200	[thread overview]
Message-ID: <19970909082824.AxurU5rmD4DKHFceQNb-ivwXvqudRrgGH8Y-HTxjDuw@z> (raw)

Hi
Yesterday I solved problem with compiler - cleaned up code. Everything
seems to work now. 9c is nice, that it detects ugly code and automatically
refuses it. :) Maybe UGLYNESS constant should be set higher in next
version.

I also did some cleaning in order to make XaoS smaller
but not big success :( Just saved about 8KB of executable...

Question 1:
Since XaoS now seems to work, I decided to start work at multithreading.
I ran into problems with plan9 api.
I use following scheme: I have queue with points, each processor takes
point from queue, calculates it and its neighbors and adds new points
into queue if neccesary.
I need an lock to queue to avoid conflicts. I found spinlocks in plan9
API, but I wonder if they eats CPU time or not. At least BeOS implementation
of spinlocks is that CPU waits in loop until other CPU unlocks it. It is
not what I need, since I want to do tests at singe CPU, where it should
make problems....
And other problem is that in case queue is empty, thread has to asleep,
since other process should be calculationg some pixel and then when he
adds new points into queue, it calls wakeup function to wakeup waiting
process, that should start processing new points.
At the end, when threads know that he is latest working, and that queue
is empty, he sets exit flag and wakes up all threads, they reads exit flag
and exits imediately.

Is there some sleep/wakeup mechanizm (in combination with locks, since I
need to be sure that when process asleeps, queue is empty. So I need
stuff similiar to cond in POSIX).

Or is there some completly different way to implement this eleganlty using
plan9 API?
I saw sleep/wakeup implementation in docs. Is this function in libc, or
do I need to copy sources?

Question 2:
What bitmap depts 81/2 currently supports? 1bpp,8bpp and some others?

Many thanks to those, who replied to my last question. This list
seems to be most helpfull from all lists I ever saw!

Honza
-- 
------------------------------------------------------------------------------
                   Have you browsed my www pages? Look at:
                       http://www.paru.cas.cz/~hubicka
      Koules-the game for Svgalib,X11 and OS/2,  Xonix-the game for X11
      czech documentation for linux index, original 2D computer art and
              funny 100 years old photos and articles are there!





             reply	other threads:[~1997-09-09  8:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-09  8:28 Jan [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-09-11  8:32 Jan
1997-09-10 15:40 Tom
1997-09-10  8:53 Jan
1997-09-09  6:39 forsyth

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=19970909082824.AxurU5rmD4DKHFceQNb-ivwXvqudRrgGH8Y-HTxjDuw@z \
    --to=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).