Lect2. Personality(2) - Linux manual page. PERSONALITY(2) Linux Programmer's Manual PERSONALITY(2) NAME top personality - set the process execution domain SYNOPSIS top #include <sys/personality.h> int personality(unsigned long persona);
The Thing King. I hope the previous post explained virtual memory adequately, but I must admit I held back a much better explanation, which I first saw in Expert C Programming.
It wasn’t written by the book’s author, Peter van der Linden, but rather by Jeff Berryman in 1972. Here goes: The Thing King and the Paging Game This note is a formal non-working paper of the Project MAC Computer Systems Research Division. Anatomy of a Program in Memory. Memory management is the heart of operating systems; it is crucial for both programming and system administration.
In the next few posts I’ll cover memory with an eye towards practical aspects, but without shying away from internals. While the concepts are generic, examples are mostly from Linux and Windows on 32-bit x86. Closures, Objects, and the Fauna of the Heap. The last post in this series looks at closures, objects, and other creatures roaming beyond the stack.
Much of what we’ll see is language neutral, but I’ll focus on JavaScript with a dash of C. Let’s start with a simple C program that reads a song and a band name and outputs them back to the user: If you run this gem, here’s what you get (=> denotes program output): Epilogues, Canaries, and Buffer Overflows. Last week we looked at how the stack works and how stack frames are built during function prologues.
Now it’s time to look at the inverse process as stack frames are destroyed in function epilogues. Let’s bring back our friend add.c: We’re executing line 4, right after the assignment of a + b into result. This is what happens: Journey to the Stack, Part I. Earlier we’ve explored the anatomy of a program in memory, the landscape of how our programs run in a computer.
Now we turn to the call stack, the work horse in most programming languages and virtual machines. Along the way we’ll meet fantastic creatures like closures, recursion, and buffer overflows. Recursion: Dream Within a Dream. Recursion is magic, but it suffers from the most awkward introduction in programming books.
They’ll show you a recursive factorial implementation, then warn you that while it sort of works it’s terribly slow and might crash due to stack overflows. “You could always dry your hair by sticking your head into the microwave, but watch out for intracranial pressure and head explosions.