Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1




|Views: 52|Likes:
Published by Riccardo Mantelli

More info:

Published by: Riccardo Mantelli on Apr 01, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





nder a proprietary model, the executable is all, bypassing allthat is cultural or textual, and ignorant o any code aboveburied instruction sets. With a transparency plagued only byalways impending crash and implied viral burn, the icon is the action;a conditioned reex with GUI designers very much as Pavlov’s eager pupils. It’s all a game o click and run, or, with the cynical humour o small-time peripheral peddlers, plug and pray. Just remember to keep your data sae as the creaking ship o an insecure OS tosses andheaves on an ever-angry networked ocean. Yet back in the day, Unix users could well be regarded as urnishedwith a tougher deal, given the plain sailing on the opaque waters o closed code beore the Net storm, the revenge o a bullying binarybecome promiscuous. Unix users, and by descent, GNU/Linux usersare well amed or bare-backed metal riding, herding naked processthrough an intricate codescape. We can choose to kill processes, trackdown zombies and ork and die in a realm o execution under whichparent processes outlive their children. The parent process is a spiritmedium awaiting signals rom its ospring rom the other side. Andreadily available ree source code is riddled with such reerenceswhich could well rival the lyrics o many a death metal band. Opensource as open history and open discourse allows us to trace thisstench o death within computation, to ask why giving the breath o lie to a new process is termed execution and how the already deadreuse to be killed. As programmers, with a ew conditionals we canreadily question the Shakespearean terms o sleep, or even usleep,with C code sleep() unction specifed in seconds. Echoing the title o many a B grade horror flm, we can choose to scream and die, or rather simply print an error message beore crashing out. And crashitsel, explored in LinuxUser & Developer issue 50, remains withachingly obvious impact on computation.
The Game of Life
The list o these terms, however metaphorical, could well beextended within living code, contemporary ree computation, whilstat the same time we can look back over the history and culture o computing to view how such reerences perhaps embed earlier involvement with a very deadly game; cybernetics and computationviewed primarily as a theory and technology o war. It’s nocoincidence that the very frst processes modelled by computers wereboth those o ballistic trajectory and atomic events, in the latter instance leading towards the design o the hydrogen bomb. Tocompress a story which could occupy many pages, these twintechnologies ound later application within a cold war arms racewhich was equally well simulated as a computational process, withJohn Von Neumann’s Monte Carlo methodology, spurred on by hisinterest in games theory, as ultimate modelwithin both technology and politics; thePrisoner’s Dilemma as hardcore coding exercise or a technology and society o destruction. Yetwhat o another programming game so belovedo legendary hackers such as Richard Gosper,Richard Stallman’s mentor at MIT in the 60s; theGame o Lie? Another history could well bewritten in this light, perhaps with mention o computing pioneer Konrad Zuse, who makesplain that his frst prototype programmablecomputer, designed and built beore all others,had nothing to do with German wartime eorts. At the heart o the culture o ree sotware liesa playulness which is ar distant rom the deathdrive o Von Neumann, the model or StanleyKubrick’s crazed Dr. Strangelove. And it’s worthremembering that the ree rolling ITS(Incompatible Timeshare System) which lies atthe roots o the GNU system attempted toprevent malicious system crashes by simplymaking it all too easy, taking all the un out o the enterprise with a basic kill system command. At the same time, Alan Turing’s Bletchley Parkdecryption eorts, practical applications o theTuring machine so relevant to any theory o computation, were rapidly exploited or cold war use. And it’s worth remembering that VonNeumann leaves his legacy, the architecturenamed ater him, within almost all contemporaryprocessors or CPUs. Under such a system, dataand sotware are treated as equivalent, stored inthe same memory, with other means employedto distinguish matters. This design opens codingup to the spiralling domain o sel-modifcationand the exhilarating land o the metacircular.Programs can write programs and modiy their own processes, their inner workings in unheardo manners. Yet the price paid or the sel codingo automata, or the unifcation o data withcode, is crash. All living programs are mortal andin some way Von Neumann’s design sayssomething very interesting about lie withincomputation. Ater all, Von Neumann was
Physical computing
LinuxUser & Developer
Computation is a game of life and death, and it’s not just about fatalsoftware bugs. Martin Howse examines how free software enables us totrace the nature and culture of the executable as it impacts on the physical
The Executable’s Song 
Physical computing
LinuxUser & Developer
It’s no coincidence that       the very rst processes  modelled by computers were  both those of ballistic   trajectory and atomic events 
   A   d   a   m    H   a   r   t  -   D   a   v   i   s    /   D   H   D   M   u   l   t   i   m   e   d   i   a   G   a   l   l   e   r   y
The game of lifepresents a healthyalternative to the darkworld of theexecutable. Greppingthe kernel source forcertain keywordsshows just how much amore deadly gameenters into living code
LinuxUser & Developer
 amously interested in sel replicating automata,and with data or the description o possibleospring, and code or process, the physicalmachine itsel, on an equal ooting, hisarchitecture readily embeds sel-reproduction.It’s a necessarily viral architecture with replicationabounding.
The poLiTics of process
 Yet, reducing this deadly crash potential to asymptom o a attening o privilege meansintroducing hierarchy into the equation.Segmentation, segregation, and a division intokernel and user modes mark splits which render the process political at a number o levels. Thedivision between so called real and protectedmode embedded within all x86 compatible CPUsexposes the degree o control which is aordedhardware vendors. The hierarchy o user andkernel mode heralds a rough division betweenuser, or rather application programmer, andkernel coder. The kernel hacker dictates how lessenlightened app monkeys code GUIs which usersare then orced to adapt to. It’s a loose chain o command, which, travelling up rom hardware,through the layers o abstraction within sotware,arrives at the interace; a return journey whichprocess undertakes and which can well betraced. At the same time a similar route isventured at boot time; a trip rom bare hardware, through BIOS inreal mode, straight to protected mode as the OS bootstraps thecommandline interace into existence. Already, there’s a good deal on oer here, material ripe or analysisand using a ree sotware OS implementation, with ready source codeaccess under grep and riends, and with open tools such as the GNUdebugger GDB and strace system call tracing tool we can readily askessential questions, interrogating the political nature o computationalprocess. With /usr/src/linux as our starting point we can well illuminatecomputation through analysis o what happens at the micro and macrolevels; the magical transormation rom code to action which processmarks in a journey rom user to kernel space and back again, passingthrough the analogue barrier o noise at the electrical level o the CPU. With reerence to the parallel journey at boot time into protectedmode, we can grep through code under /usr/src/linux/arch/i386/bootto fnd exactly when the transition is made.
fork and die
 Yet beore we’re ready to walk the code, or strace the process, anenlightening aair both or debugging and perormance tuning, it’sworth asking what process encompasses under computation, andwhat exactly constitutes a process within the specifc terms o a Unix-like OS. In the frst instance the transition rom code to execution, rom command to result, marks the process. Many writers have alsodescribed computational process with reerence to magic; the processas an invisible spirit conjured up by a sorcerer’s spells, or programs, yet still obtaining quite physical eects in the real world.Process is the only entry point into crash and the virus. At the sametime computers simulate and model processes rom the real world,and the relation between the two marks process as interace. Drillingdown to a more specifc context, and sticking with the commandline,process and program, or executable become separated. Under theterms o a Unix operating system, a program is run, that is to sayexecuted, within a process. Process is that which renders theexecutable, a bland ELF (Executable and Linking Format) fle withadditional libraries, runnable, passing code to the kernel by way o the ubiquitous interace o the system call which unctions as aspeakeasy style hole in the wall between user and kernel spaces.The process keeps track o the state o the running program. GNU/Linux users will no doubt be amiliar with the common ps commandwhich details a vast array o such inormation regarding processes. Allthat runs, and in some instances, as we’ll see in the case o zombies,which doesn’t run, is process, assigned a unique ID by the kernel. Buthow do such magical processes come into being, i we need a processto execute and manage code, and where does this process come rom? In Unix there is but one parent process, init, whose invocationwe can again trace to source outlining the boot code. Init is theancestor, or parent, o all processes, which are known as childprocesses. Init has a process identifer, a PID, o one. It’s our originalunit, rom which the shell is spawned. And the shell, rom which weissue commands, can urther deliver ospring which are themselvescapable o birthing processes. Such a spawning is known as orking,under which the existing process is duplicated with the childreceiving new parameters. The parent is responsible or the childprocess, hence the common Unix geek joke that “children are orkedby their parents who then wait or them to die...”Process creation and termination can be readily tracked down to ork.c and exit.c under the main kernel directory o /usr/src/linuxwhich provide clues to process management under GNU Linux. Theattributes o a process are crammed into a data structure called task_struct which allows or scheduling (see sched.c) and memorymanagement, enabling switching between processes without losingtheir state and context. Ater all it’s worth remembering that onemain role o a multitasking kernel is to control when the process hasaccess to the bare metal o the CPU. The kernel dictates thephysicality o execution, acting as key interace between code and thereal world. Without OS the executable is just junked data. Yet orking doesn’t quite take us the ull distance into the land o execution. Forking means that we have two copies o the sameprogram running. One o them usually executesthe binary making use o one o the exec() amilyo system calls which will replace the processwith another process. The exec() system calllocates the binary image o the executable, loadsit, and runs it, taking care o binary ormats andshared libraries.
happy famiLies
The great amily tree o init can be examined onany live system by issuing the simple pstreecommand. On the author’s system we see init onthe ar let, with multiple descendants, such as thevarious system daemons which kick o at boottime. We can ollow the branch which marks our current process rom init, through login, Bash,startx, xinit, X into window manager Ion andthence rom xterm, and Bash into GNU Emacs. Another view o process is oered using thestrace command, making use o the ptrace
LinuxUser & Developer
Physical computing
Under GDB, thesuperbly intricate GNUdebugger, we canreadily issuebreakpoints and thuspull apart frozen code,viewing process from amyriad of embeddedangles
Under a proprietary OS thesystem is quite obviouslyobscured, conditioning theuser under a supposedlynatural interace; theprogrammer as god hidingbehind veiled error messagesmasking a very human ailure.The error message isconsidered as a natural sign, atrue symptom with some linkto an underlying natural cause. A psychosomatic responseissued by a body o code, acomponentless, purely binarybody. It appears to the casualuser as set in stone, flled withdark intent as it seemingly hails rom the other side o crashland. Ater all how can acrashing system report its owndeath? Yet, its arbitrary nature iswell belied by ree sotwarewith apparent code, searchableas to exact message and cause.The decisions o a nowhumbled programmer or collective are exposedalongside colloquialcomments. Rather thanviewing a message as totallymeaningul, as imbued with anoracular aura, ree sotwarereveals the truly error proneand noisy realm o analoguecode. Coders write error messages, not computers, andprogrammers can always makemistakes. Error codes needmake little sense, with lazygrasp-all cases embracing allmanner o ills under the samebanal message.Exposure is a key concept or both ree sotware and whatcould be reerred to as codeart, rendering a geologicalaesthetic, which may becontrasted with the art o thelandscape, along the rich seamo executable or runnablestrata meeting the readableand writable. Technique andtechnology are revealedneither as ends in themselvesnor as tools or the productiono stock works, but rather as anexplosive and extremelygratiying sel exposure o ideas. In the words o Wildeanprogrammer, Alan J. Perlis,preacing one o the greatestcomputer science works,Structure and Interpretation o Computer Programs, “Thesource o the exhilarationassociated with computer programming is the continualunolding within the mind andon the computer o mechanisms expressed asprograms and the explosion o perception they generate.”Computers model process,execution is process and reesotware exposes all theprocesses, social, cultural,economic and otherwise whichwrap up code.
OS natur
Reducing this deadly crash potential    to a symptom of a attening of    privilege means introducing  hierarchy into the equation 
The ps command,with an array ofcommand lineoptions, and relatedpstree tool, providefor yet another viewof running process,here showing thehierarchy of parentand child process on aworking system
Physical computing

Activity (4)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
spiccato2013 liked this
hairullisa liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->