Re: MyStyle database.

Ethan (allanon@crystaltokyo.com)
Tue, 9 Feb 1999 02:57:15 -0800 (PST)



I like the idea of a single MyStyle database.  It has the advantage of 
allowing inheritance from one style to (potentially) afterstep and every 
module at once.  I agree with Doug and Michal - shared memory is not the 
way to go.  It isn't particularly portable, and would require careful 
coding to keep the pointers that afterstep and the modules use in sync, 
particularly after an update.

We have a communication method already in place, if we care to use it.  
However, passing large chunks of text over the pipes risks killing modules 
during times of high cpu load (due to timeouts).  It would also slow down 
any processes involved in the transfer.

There are a couple of things I can think of that we might do to reduce 
the overhead of keeping all styles in one file.

1. We might want to read the entire file into the memory area of one 
   process's (afterstep or, say, asconfig) memory, keeping everything 
   as strings.  Then when a style is requested, send only the style(s) 
   necessary to satisfy the inheritance list of the requested style.  
   Note that we could simplify this by sending the result of applying 
   the inheritances to the requested style, instead of all of the 
   inherited styles.

2. We might want to separate the reading of the config file into two 
   passes.  In one pass, we build an inheritance table, in the second, 
   we read the necessary styles.  This has the advantage of not parsing 
   every style (and not eating memory thereby), but we still have the 
   overhead of reading the file twice.  Note that on a file-caching 
   system (any modern unix), this overhead is pretty low.

3. We might want to read all of the styles in and parse them into their 
   final form, in one process (afterstep or asconfig).  Then when a style 
   is requested, pass the result (as a completely inherited style) to the 
   requesting module.  This works because the X resource IDs are global 
   to the server.  Note that if the central repository of styles was 
   killed for some reason, afterstep and all modules would likewise 
   quickly die, as the X resources would be deallocated.

In all cases, we could still parse styles from the module config, and 
simply supplement them with styles from the central database.

----
Ethan Fischer
allanon@crystaltokyo.com
http://members.xoom.com/allanon1