Paternoster of Programmers Reloaded

C, C++, Java, Python and AspectJ Case Studies

Dr. Norbert Bátfai

Asst Prof, IT Dept, UD
Assistant professor
University of Debrecen, Faculty of Informatics
Department of Information Technology

Dr. András Keszthelyi

Szakmai lektor 
Associate professor
Associate professor
Óbuda University

Ildikó Novák

Language reviewer 

Author's edition

The lecture notes were supported by the TÁMOP-4.1.2.A/1-11/1-2011-0103 project. The project has been supported by the European Union, co-financed by the European Social Fund.

The Hungary's Renewal Logo.

The Logo of the New Széchenyi Plan.

The author endeavors to maintain and to keep the author's editions of this book, and the others in the series up-to-date. These author's editions can be found at the page


Revision History
Revision 0.0.131 May 2012Bátfai
I have started to write this book (called POPR book in the following) from the version 0.0.11 of the Hungarian edition, entitled „Programozó Páternoszter újratöltve: C, C++, Java, Python és AspectJ esettanulmányok” (PROP könyv).
Revision 0.0.210 June 2012Bátfai
I have started the section Simplification of the AI-based simulation model of RCSS.
Revision 0.0.33 July 2012Bátfai
The chapter titled The simplified down protocol of 2D RCSS is reorganized.
Revision 0.0.48 Sept 2013Bátfai
The legal notice paragraph is translated from Hungarian to English.
Revision 0.0.99 Sept 2013Bátfai
The first two case studies have been translated.
Revision 0.0.1924 Sept 2013Bátfai
The preface has been translated.
Revision 0.0.2125 Sept 2013Bátfai
The third case study has been translated.
Revision 0.1.27 Feb 2014Bátfai
The environment of the book has been updated with the book called The Yearbook of the Programmers of University of Debrecen.
Revision 0.1.413 Feb 2014Bátfai
Incorporation of improvements made by the language reviewer.
Revision 0.1.6-0.1.1820 Feb 2014Bátfai
Revision 0.2.0Bátfai


This book is dedicated to my acquaintances on social networks.

Table of Contents

1. Introduction
The Paternoster of Programmers
About these lecture notes
The environment of this book
The courses of the book
About the author
About the peer reviewers
I. C Case Studies
2. MINIX kernel hacking: analysing microkernel's IPC
Introduction: the MINIX which acted as the detonator of open source
The MINIX microkernel and the MINIX IPC
The installation of MINIX3 system
Installation in VirtualBox
The first MINIX kernel hacking
Analysis of MINIX3 IPC
A solution with modifying the PCB
Another solution by introducing a new system call
3. GNU/Linux kernel hacking: making entries in the /proc virtual file system
The monolithic kernel of Linux
Linux kernel compiling
Kernel modules
Making entries in the /proc virtual file system
Creating the module in VirtualBox.
4. Berkeley socket API, Sys V IPC and I/O multiplexing
Berkeley socket API, Sys V IPC, I/O multiplexing
A simple client/server sample
The client side
The server side
Testing of the example
II. C++ Case Studies
5. A simplified protocol of 2D RCSS
Emasculation of the AI-based simulation model of RCSS
Introducing a new positioning command for RCSS client protocol
The team called Debrecen Great Forest FC++
The implementation of the throw-in
The introduction of the tactical lineups
The team called Debrecen Deep Forest FC++
The evaluation of the team Debrecen Deep Forest FC++
The team called Debrecen Round Forest FC++
The additional command line arguments of the simplified server
Introducing the usage of the online coach
III. Java Case Studies
6. Community consciousness net
The Seventh Eye mobile game
The Seventh Eye and the „Community consciousness net”
IV. Python Case Studies
7. A virtual librarian
Kálmán Könyves
The structure of the AIML files
V. AspectJ Case Studies
8. What is the mother tongue of the object oriented programs?
An analytical weaving
A robot soccer weaving

List of Figures

2.1. SEND and RECEIVE message passing primitives.
2.2. The sender is blocked while the receiver is not ready to receive.
2.3. The receiver is blocked while the message is not being received.
2.4. Giving the name of the MINIX system that will be installed.
2.5. Launching the virtualized MINIX.
2.6. Starting the installation.
2.7. Loading the system from disk.
2.8. We accept defaults, mutatis mutandis.
2.9. MINIX starts from hard disk now.
2.10. Opening the source file kernel/main.c with vi.
2.11. The modification of the function announce() in the kernel/main.c source file.
2.12. The booting of the newly compiled kernel.
2.13. The message from the kernel.
2.14. The first step of managing packages.
2.16. Printing out the size of the PCB and the size of the process table.
2.17. Read the size of the PCB and the size of the process table.
2.18. Extending the MINIC PCB.
2.19. Counting massages.
2.20. The kernel process table.
2.21. Connecting a debug function to a function key.
2.22. The beginning of the function uzenetszam_dmp.
2.23. The midst of the function uzenetszam_dmp.
2.24. The end of the function uzenetszam_dmp.
2.25. The prototype of the function uzenetszam_dmp.
2.26. Displaying the IPC matrix.
2.27. List of the non-empty slots from the process table.
2.28. An array to store the „IPC matrix”.
2.29. Incrementing of the appropriate element of the uzenetszam array.
2.30. This is the uzenetszam that we defined in the server layer.
2.31. Usage of the sys_getmatrix system call that will be newly developed.
2.32. Printing the matrix.
2.33. Defining the sys_getmatrix macro.
2.34. The GET_MATRIX macro.
2.35. Supplying the do_getinfo system call.
2.36. Displaying the IPC matrix in the second solution.
3.1. Downloading the kernel sources.
3.2. Making the .config with command make menuconfig.
3.3. Setting the option Kernel .config support.
3.4. Starting the compiling.
3.5. Starting the installation.
3.6. The version of the running kernel.
3.7. The updated GRUB menu.
3.8. The new kernel.
3.9. Switching off the option Enable loadable module support.
3.10. The size of the kernel image.
3.11. The circular doubly linked list of PCBs in Linux.
4.1. Compiling the client and the server.
4.2. Running the client and the server.
4.3. Checking the results.
5.1. The LightFC++ team assembles before kick off using the move command.
5.2. After kick off the players move using the pos command.
5.3. Testing the throw-in: player 11 kicks the ball across the touch line.
5.4. Testing of the throw-in: player 4 starts to move towards the ball.
5.5. Testing the throw-in: player 4 is closer than 30 meters.
5.6. Testing of the throw-in: player 4 has just arrived to the ball.
5.7. Testing of the throw-in: player 4 passes the ball to player 3.
5.8. Testing the throw-in: the ball is moving towards player 3.
5.9. The 4-4-2 formation.
5.10. Corner kick formations.
5.11. Player 3 and player 6 should go to the ball.
5.12. An opposing player gains possession of the ball.
5.13. A portion of the soccerwindow2's log file.
5.14. The Debrecen Round Forest FC++'s team logo in the soccerwindow2 and the rcssmonitor.
6.1. The starting icon of the Seventh Eye.
6.2. The splash screen of the Seventh Eye.
6.3. The main menu of the Seventh Eye.

List of Examples

2.1. Number of processes
2.2. The size of the PCB
2.3. Non-empty slots
3.1. The contents of the PCB
3.2. Playing the game with the current macro
3.3. Drawing a memory map
4.1. 30 processes, with using a paper and pen
5.1. Placing a player beside a goalpost
5.2. Free kicks
5.3. Do not pass backward
5.4. A good starting
5.5. Create the your own XPM team logo
6.1. Running the Seventh Eye on a real mobile phone
6.2. The client side of the „Community consciousness net”
6.3. The server side of the „Community consciousness net”
6.4. A community-based exercise
6.5. A community portal based on the mental fingerprints
7.1. Kálmán Könyves on IRC using the Program W
7.2. Kálmán Könyves on the web using the Program D
7.3. Create your own chatterbot
8.1. Weaving this aspect into ALICE
8.2. Try this AspectJ aspect yourself