blob: 3c72869e65b5ae069a1f07ecf6285a25f3663b65 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra7ea4a032019-11-26 20:11:40 +01002 void slow_shut_down(int minutes)
MG Mud User88f12472016-06-24 23:31:02 +02003
4DESCRIPTION
Zesstra7ea4a032019-11-26 20:11:40 +01005 Schedule a shutdown for the near future. minutes is the
6 desired time in minutes till the shutdown:
7 six, if just the user reserve has been put into use.
8 one, if the (smaller) master reserve has been put into use as
9 well.
MG Mud User88f12472016-06-24 23:31:02 +020010
Zesstra7ea4a032019-11-26 20:11:40 +010011 The interpreter calls this function when it runs low on
12 memory. At this time, it has freed its reserve, but since it
13 won't last long, the interpreter needs to be shut down. The
14 delay is to give the users the opportunity to finish their
15 current tasks, but don't take the 'minutes' for granted, just
16 deduce the urgency from it.
MG Mud User88f12472016-06-24 23:31:02 +020017
Zesstra7ea4a032019-11-26 20:11:40 +010018 It is possible that the driver may reallocate some memory
19 after the function has been called, and then run again into a
20 low memory situation, calling this function again.
21
22 This function might load an 'Armageddon' object and tell it
23 what to do. It is the Armageddon object then which performs
24 the shutdown.
25
26 Technical: The memory handling of the interpreter includes
27 three reserved areas: user, system and master. All three are
28 there to insure that the system shuts down gracefully when the
29 memory runs out: the user area to give the users time to
30 quit normally, the others to enable emergency-logouts when the
31 user reserve is used up as well.
32
33 The areas are allocated at start of the interpreter, and
34 released when no more memory could be obtained from the host.
35 In such a case, one of the remaining areas is freed (so the
36 operation can continue a short while) and a garbage collection
37 is initiated. If the garbage collection recycles enough memory
38 (either true garbage or by the aid of the quota_demon) to
39 reallocate the areas, all is fine, else the system shut down
40 is invoked by a call to this function.
MG Mud User88f12472016-06-24 23:31:02 +020041
42SEE ALSO
Zesstra7ea4a032019-11-26 20:11:40 +010043 quota_demon(M), notify_shutdown(M), shutdown(E), malloc(D), memory(C)
44 low_memory(M)