1 |
It is definitly possible. |
2 |
Might require writing a little c proggy: |
3 |
waitpids pid1 pid2 .... |
4 |
which returns when ANY of the processes terminates. |
5 |
The rest can be implemented in sh. |
6 |
Or the whole process can be implemented in Python ( thought I don't like |
7 |
the idea of boot process in python) |
8 |
|
9 |
The following is a simplified python/sh algo :-). All marking of who is |
10 |
started + dependencies etc. is done, like in present version, through |
11 |
files and dirs in /dev/shm |
12 |
----------------------------------------------------------- |
13 |
|
14 |
function can_start(): |
15 |
if depend($1) == '' |
16 |
return TRUE;# no dependencies |
17 |
for service in depend($1) |
18 |
if not_started(service): |
19 |
return FALSE; |
20 |
return TRUE; |
21 |
|
22 |
|
23 |
|
24 |
|
25 |
while not all services started: |
26 |
for every service that not started: |
27 |
if can_start(service): |
28 |
service& |
29 |
PIDS="$PIDS $!" |
30 |
PIDS = `waitpids $PIDS` # will wait for at least one process to |
31 |
# terminate, so we MAY be able to start more |
32 |
# services |
33 |
----------------------------------------------------------- |
34 |
|
35 |
It is more complicated than that, but not much. |
36 |
exit satatus, error handling, service start output, circular dependancy |
37 |
and timeouts are some of the issues that need to be solved. |
38 |
|
39 |
I might implement it when I'll have some more time then right now (busy |
40 |
working) |
41 |
|
42 |
|
43 |
|
44 |
On Mon, 2001-12-03 at 15:54, Joshua Pierre wrote: |
45 |
> On Mon, Dec 03, 2001 at 08:46:21AM +0100 or thereabouts, Sebastian Werner wrote: |
46 |
> > I have a good dream last night. Some days ago I find the tool from |
47 |
> > Microsoft to optimize the boot time of their new system (winxp). The |
48 |
> > idea is to run some services to system-init parallel. Or in other words: |
49 |
> > Why we must wait for samba to start xdm. Couldn't we use the |
50 |
> > multitaskting experience of linux in our init-scripts. So we can start |
51 |
> > Linux in near the half time I think. Good or bad idea? |
52 |
> |
53 |
> Not sure if it is possible but maybe a manual way to set the order in which the init scripts start. |
54 |
> |
55 |
> However, a few of the init scripts might have whacky depends making things wait uncessarily. |
56 |
> |
57 |
> Who knows but a way to manually change the boot order would be great but as I said above I am not sure if it is possible or not. |
58 |
> |
59 |
> Cheers, |
60 |
> |
61 |
> -- |
62 |
> Joshua Pierre |
63 |
> Developer & Release Technician |
64 |
> Themes.Org -- Open Source Interface Enhancement |
65 |
> _______________________________________________ |
66 |
> gentoo-dev mailing list |
67 |
> gentoo-dev@g.o |
68 |
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev |