Developers Club geek daily blog

Program anatomy in memory

1 year, 9 months ago
Memory management – one of the main tasks of OS. It is critical both for programming, and for system administration. I will try to explain how OS works with memory. Concepts will be the general character, and I will follow examples from Linux and Windows on 32-bit x86. At first I will describe how programs are located in memory.

Each process in multitask OS works in "sandbox" in memory. This virtual address space which in the 32-bit mode represents itself 4 GB the block of addresses. These virtual addresses are put in compliance (mapping) of physical memory by tables of pages which are supported by OS kernel. Each process has the set of tables. But if we begin to use virtual addressing, it is necessary to use it for all programs working at the computer – including also a kernel. Therefore the part of space of virtual addresses needs to be reserved under a kernel.

image

It does not mean that the kernel uses a lot of physical memory – just at it the part of address space which can be put in compliance to necessary amount of physical memory is at the disposal. The memory space for a kernel is noted in tables of pages as exclusively used exclusive code therefore if any program tries to get in it access, there is page fault. The memory space for a kernel is present at Linux constantly, and puts in compliance the same part of physical memory at all processes. The code of a kernel and data always have addresses, and are ready to process interruptions and system calls at any time. For the user programs, on the contrary, compliance of virtual addresses of real memory changes when there is a switching of processes:

Read more »


One more way of automatic call of unit-tests in the Xi language

1 year, 9 months ago
On Habré already there are some articles how to develop modular tests in the Xi language. I am not going to criticize the described approaches, and only I will offer one more — what we use in Habré's project.

To whom it is interesting, I ask tackle! But I warn: there are a lot of footcloths from macroes and "linkersky" magic.

Read more »


The world moves language C

1 year, 9 months ago


Recently we have published transfer of article in which arguments in favor of studying of languages of family C were adduced. This post has caused many disputes, including the point of view has been stated that languages of family C quit the stage; their demand though is great, but decreases. Perhaps, it and so. But nevertheless language C still remains to one of the most widespread.

Read more »


Stop checking for NULL

1 year, 9 months ago
Sooner or later in programs on C ++ it is necessary to use transfer of arguments to function according to the pointer. At least the same const char * can be example when using libraries of access to databases:

void Execute(const char* sql_statement);


There are also cases of object passing and primitive types according to the pointer.

I would like to tell that many C programmers and C ++ for certain do: check input parameter pointer for NULL (nullptr):

Read more »


Whether there is domestic processor of Multiklet?

1 year, 9 months ago
In this post I want to tell about our efforts on use of the Russian processor with original architecture the SIP telephone about which we already told.

It will be a question of problems which we had faced in the course of transfer, and how we fixed these problems. Perhaps, it will be interesting not only that who is going to use this processor, but also that who will need to pass from the c99 and gcc standard to the c89 standard and any compiler, incompatible with gcc. Also in the conclusion I will dare to add personal feelings from interaction with this platform.

Read more »


Be simpler, and people will stretch to you or how to fall in love with Xi, having saved mind

1 year, 9 months ago
I on life the self-educated person: except for FORTRAN and PL/1 to which I was "taught" in HIGHER EDUCATION INSTITUTION (I hope, clearly, how long it was?), I have gained the main part of the knowledge of programming only by self-education method. Began, as usual, with Pascal and its logical continuation of Delphi. In process of change of priorities mastered the assembler of the 86th family (MS DOS), and then, in process of hobby for microcontrollers has mastered ASM51 and AVR Assembler. All this was given me rather simply since all listed gives in very simple and, the main thing, to accurately structured logical description — I mean syntax and the principles of language.

Also the following step — transition to Xi (I will emphasize — in my case the speech about programming of microcontrollers), and here, as they say, was naturally inevitable process has stopped. Xi's syntax — that still feature, books on this language — the separate song. Even at classics K&R; from the first chapter "the working helloword", thus falls upon weak brain of beginner that the uniform word about syntax, about operators has not been, etc. told! When I have started studying language standard of Xi, I had suicide depressions, because the concept of the standard which has earlier settled down in brain as accurate regulations, it has been destroyed almost completely!

And therefore I for myself have prepared some "rules of reduction for logically consistent definitions" which have allowed me to master more or less quietly the Xi language and even sometimes (!) to teach other beginners.
It seems to me that Xi starting mastering will not prevent to learn at least about one such "rule".

Read more »


About advantage of studying of languages of family C

1 year, 9 months ago


If you have reflected on mastering the first in the life programming language, you should break the head over that and what to select from variety of the existing languages. JavaScript reigns in the world of web development, in many HIGHER EDUCATION INSTITUTIONS and schools suggest to study Python. If to ask at forums, to you will throw out heap of options, including Haskell, Scala and Erlang. The richness of choice well almost in any business, and abundance of programming languages testifies that this direction of scientific and applied activity continues to develop. To one person already not in power to learn all existing languages therefore it is necessary to decide what language to begin to master best of all. Often study that is accepted in the specific company or segment of the market. But if you are only going to take the first steps on programming field, it is possible to recommend to begin with one of languages of family C. It will be the most far-sighted choice which will help you with career. Perhaps, you will not begin to write daily in this language, or will not learn it very deeply. But if you want that to you treated as the serious developer, you should own one of languages of family C.

Read more »


Webinar "Acquaintance to FlyElephant"

1 year, 9 months ago

Read more »


How to transfer the project of 9 million code lines in size to 64-bit platform?

1 year, 9 months ago
64 бита? О, интересненько!
Recently our team has completed migration on 64-bit platform of the happy big project (9 million code lines, 300Mb source codes). The project has taken one and a half years. Though owing to NDA we cannot provide the name of the project, we hope that our experience will be useful to other developers.

Read more »


Ideal way of implementation of a static code analyzer

1 year, 10 months ago
Apple II emulator for Windows
One of the main difficulties when using instruments of static analysis is work with false drops. There is a set of methods to eliminate false drops, using settings of the analyzer or changing a code. I took the small Apple II emulator for Windows project and I will show how it is possible to work at practice with the report of the static PVS-Studio analyzer. I will show on examples how to correct mistakes and to suppress false drops.

Read more »