MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame^] | 2 | void slow_shut_down(int minutes) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
| 4 | DESCRIPTION |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame^] | 5 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 10 | |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame^] | 11 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 17 | |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame^] | 18 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 41 | |
| 42 | SEE ALSO |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame^] | 43 | quota_demon(M), notify_shutdown(M), shutdown(E), malloc(D), memory(C) |
| 44 | low_memory(M) |