diff options
| author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-10 18:40:27 +0000 |
|---|---|---|
| committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-10 18:40:27 +0000 |
| commit | fdf2b50316cc33a788e10140f04b990378f65486 (patch) | |
| tree | 40ea5f8a2e65033942b343d4a3edb61c986c7381 /docs/busybox.net/programming.html | |
| parent | 81c40b39cbae084777c93fe5303c4ba9af8137c6 (diff) | |
| download | busybox-w32-fdf2b50316cc33a788e10140f04b990378f65486.tar.gz busybox-w32-fdf2b50316cc33a788e10140f04b990378f65486.tar.bz2 busybox-w32-fdf2b50316cc33a788e10140f04b990378f65486.zip | |
- make it resemble english and fix typo s/interperet/interpret/g;
Diffstat (limited to 'docs/busybox.net/programming.html')
| -rw-r--r-- | docs/busybox.net/programming.html | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/busybox.net/programming.html b/docs/busybox.net/programming.html index 1214e70f7..f54f018ed 100644 --- a/docs/busybox.net/programming.html +++ b/docs/busybox.net/programming.html | |||
| @@ -259,15 +259,15 @@ before freeing them.</p> | |||
| 259 | <p>With a very primitive MMU (using a base pointer plus length instead of page | 259 | <p>With a very primitive MMU (using a base pointer plus length instead of page |
| 260 | tables, which can provide virtual addresses and protect processes from each | 260 | tables, which can provide virtual addresses and protect processes from each |
| 261 | other, but no copy on write) you can still implement fork. But it's | 261 | other, but no copy on write) you can still implement fork. But it's |
| 262 | unreasonably expensive, because you have to copy all the parent process's | 262 | unreasonably expensive, because you have to copy all the parent process' |
| 263 | memory into the new process (which could easily be several megabytes per fork). | 263 | memory into the new process (which could easily be several megabytes per fork). |
| 264 | And you have to do this even though that memory gets freed again as soon as the | 264 | And you have to do this even though that memory gets freed again as soon as the |
| 265 | exec happens. (This is not just slow and a waste of space but causes memory | 265 | exec happens. (This is not just slow and a waste of space but causes memory |
| 266 | usage spikes that can easily cause the system to run out of memory.)</p> | 266 | usage spikes that can easily cause the system to run out of memory.)</p> |
| 267 | 267 | ||
| 268 | <p>Without even a primitive MMU, you have no virtual addresses. Every process | 268 | <p>Without even a primitive MMU, you have no virtual addresses. Every process |
| 269 | can reach out and touch any other process's memory, because all pointers are to | 269 | can reach out and touch any other process' memory, because all pointers are to |
| 270 | physical addresses with no protection. Even if you copy a process's memory to | 270 | physical addresses with no protection. Even if you copy a process' memory to |
| 271 | new physical addresses, all of its pointers point to the old objects in the | 271 | new physical addresses, all of its pointers point to the old objects in the |
| 272 | old process. (Searching through the new copy's memory for pointers and | 272 | old process. (Searching through the new copy's memory for pointers and |
| 273 | redirect them to the new locations is not an easy problem.)</p> | 273 | redirect them to the new locations is not an easy problem.)</p> |
| @@ -307,7 +307,7 @@ failed to exec.)</p> | |||
| 307 | (which presumably is much shorter than the heap), and leave the heap shared. | 307 | (which presumably is much shorter than the heap), and leave the heap shared. |
| 308 | Even with no MMU at all | 308 | Even with no MMU at all |
| 309 | In practice, you've just wound up in a multi-threaded situation and you can't | 309 | In practice, you've just wound up in a multi-threaded situation and you can't |
| 310 | do a malloc() or free() on your heap without freeing the other process's memory | 310 | do a malloc() or free() on your heap without freeing the other process' memory |
| 311 | (and if you don't have the proper locking for being threaded, corrupting the | 311 | (and if you don't have the proper locking for being threaded, corrupting the |
| 312 | heap if both of you try to do it at the same time and wind up stomping on | 312 | heap if both of you try to do it at the same time and wind up stomping on |
| 313 | each other while traversing the free memory lists). The thing about vfork is | 313 | each other while traversing the free memory lists). The thing about vfork is |
| @@ -350,16 +350,16 @@ on their their sockets, now you know.)</p> | |||
| 350 | <h2><a name="tips_memory">Memory used by relocatable code, PIC, and static linking.</a></h2> | 350 | <h2><a name="tips_memory">Memory used by relocatable code, PIC, and static linking.</a></h2> |
| 351 | 351 | ||
| 352 | <p>The downside of standard dynamic linking is that it results in self-modifying | 352 | <p>The downside of standard dynamic linking is that it results in self-modifying |
| 353 | code. Although each executable's pages are mmaped() into a process's address | 353 | code. Although each executable's pages are mmaped() into a process' address |
| 354 | space from the executable file and are thus naturally shared between processes | 354 | space from the executable file and are thus naturally shared between processes |
| 355 | out of the page cache, the library loader (ld-linux.so.2 or ld-uClibc.so.0) | 355 | out of the page cache, the library loader (ld-linux.so.2 or ld-uClibc.so.0) |
| 356 | writes to these pages to supply addresses for relocatable symbols. This | 356 | writes to these pages to supply addresses for relocatable symbols. This |
| 357 | dirties the pages, triggering copy-on-write allocation of new memory for each | 357 | dirties the pages, triggering copy-on-write allocation of new memory for each |
| 358 | processes's dirtied pages.</p> | 358 | processes' dirtied pages.</p> |
| 359 | 359 | ||
| 360 | <p>One solution to this is Position Independent Code (PIC), a way of linking | 360 | <p>One solution to this is Position Independent Code (PIC), a way of linking |
| 361 | a file so all the relocations are grouped together. This dirties fewer | 361 | a file so all the relocations are grouped together. This dirties fewer |
| 362 | pages (often just a single page) for each process's relocations. The down | 362 | pages (often just a single page) for each process' relocations. The down |
| 363 | side is this results in larger executables, which take up more space on disk | 363 | side is this results in larger executables, which take up more space on disk |
| 364 | (and a correspondingly larger space in memory). But when many copies of the | 364 | (and a correspondingly larger space in memory). But when many copies of the |
| 365 | same program are running, PIC dynamic linking trades a larger disk footprint | 365 | same program are running, PIC dynamic linking trades a larger disk footprint |
| @@ -373,7 +373,7 @@ of a win anyway.</p> | |||
| 373 | 373 | ||
| 374 | <p>You can tell the glibc linker to display debugging information about its | 374 | <p>You can tell the glibc linker to display debugging information about its |
| 375 | relocations with the environment variable "LD_DEBUG". Try | 375 | relocations with the environment variable "LD_DEBUG". Try |
| 376 | "LD_DEBUG=help /bin/true" for a list of commands. Learning to interperet | 376 | "LD_DEBUG=help /bin/true" for a list of commands. Learning to interpret |
| 377 | "LD_DEBUG=statistics cat /proc/self/statm" could be interesting.</p> | 377 | "LD_DEBUG=statistics cat /proc/self/statm" could be interesting.</p> |
| 378 | 378 | ||
| 379 | <h2><a name="who">Who are the BusyBox developers?</a></h2> | 379 | <h2><a name="who">Who are the BusyBox developers?</a></h2> |
