Joint #01
31 января 2006 |
|
Articles - The operating system on the Spectrum. What is it?
Operating System on the Spectrum. What is it? by Vitamin Hello, dear readers! In this article, such an intriguing title will be affected Theme operating systems in general and for the Spectrum in particular. If you're expecting another advertising a new shell or praise non-existent code in the style of the Borg, we can not continue read. If possible, I will try to avoid both. Here we consider a purely technical aspect of this issue dedicated to designing, developing and, in fact, work operating systems. I can, I'll even advise read books on the subject, which of the Spectrum will be no words. Write this article I was asked the difference in a month newspaper "Passage" and a group of "Brainwave". So, turn to the facts. The course "Operating Systems" was I auditioned at the University of the standard and in front of me became such a problem - but is it possible to apply this knowledge to our Spectrum? Seeding for the book, one of which was NA Oliferov, VG Oliferov "Network Operating Systems", I received a lot of additional information from a purely theoretical field. When subsequent reading of books on Unix and I got Vindouz opportunity to compare these systems and choose the optimal solution those or other problems. Next, I will tell my thoughts about the interior of the operating system. No need to take them for dogma or a pattern. Rather, it merely recommendations, some of has been tested in practice. Some part of my investigations was published in the Zx-Time. So, I'm in something and I will repeat. So, to start to define the basic functions who will be assigned to the core of the system: 1) The implementation of multitasking. It includes functions to work with processes and allocation of CPU time. Two modes multitasking - nevytesnyayuschaya and displacing, as well as many scheduling algorithms for the latter (for the first, incidentally, too) offer unprecedented scope for implementation. The question of need to multitask at all, I believe, should not be - Too many benefits open when using it in opposed to the complexity of implementation. Willing to bet - I beg my address listed at the end. The only difference between preemptive and preemptive multitasking is capabilities of the system call scheduler at the request of the process. With preemptive multitasking simple loop can never hang the system, as it can easily happen if you do not preemptive multitasking or not at all. In the worst case, significantly reduced performance. But after removing the "hung" process, work will continue as usual. Unlike class processors x86, starting with 386, z80 does not have hardware memory protection. In other words, no way can not control the reading or writing in either memory area. Implementation of "forbidden" code in some cases can be caught. The only way to protect the core from invasion of malware is flashing it in Rom. But this step is justified only in case of a well-functioning core, the best appropriate manner possible machines. 2) Work with external devices. These devices can be anything - from the keyboard and mouse to the DMA and GeneralSound. It is only necessary to separate them into categories and carry out control in accordance with their intended purpose. For example, through disk device driver can be accessed holders of various types, ranging from the drive and ramdisk and ending with hard drive and a CD-drive. For ensure ease of expansion hardware support system necessary to provide the Device Manager, which will be provide a single interface program to access devices, depending on the category of devices, but does not depend of its type. 3) The window envelope. Graphical user interface nice stuff, but not for the system. For it is the best interface - a command line. Minimum of resources, nothing more, single interface of all programs. But try to remember all Team System! If you do it, you can call themselves a professional:) That is why people come up with so-called "Intuitive interface", the essence of which - at a minimum loading brains user to perform various tasks, albeit at the expense of productivity and performance. But even here you should not go too far. As an authority quote from the book of A. Holub, "The rope of sufficient length to ... shoot yourself in the foot "(Holub.A. Enough Rope To Shoot At Your Leg "). This is a book of tricks programming in C + +, but I think you will agree with my decision to include this quote. "... The user interface should not be like computer program (the principle of transparency). I once heard someone said that the best user interface of ever developed a pencil. His appointment immediately clear, it does not need user manual he was preparing to work without much fuss. However, the most important feature is transparency. When you use pencil, then think about what you write, not about the pencil. Like the pencil, the best computer interfaces are those that conceal the very fact that you are addressing to a computer: a remarkable example of the interface with the system ignition of your car. You turn on the ignition, include speed and presses on the gas, as if all these objects interface (switch, lever velocity, pedal) were hooked directly on the engine. Nevertheless, it is not: they are now usually just input into the computer that controls the engine. K Unfortunately, this level of clarity is often lacking in user interfaces. Imagine a GUI Windows user on the car. You touch, choosing main menu item "Movement of the car." Clicking on it opens Menu switching speed, which will offer you the choice of option "Forward", "Back" and "Neutral." Click one of the them to move the box on the direction you want. Then Go back to "Move the car, and then click "Let's go." This will bring up a dialog box "Speed" where you have to use the slider to enter the desired speed. However, to set the speed correctly is difficult because of the high permission of the slider (half a millimeter movement of the mouse corresponds to about 1 km / h), so you probably set the 59.7 km / h instead of 60. Then you click on "travel" in the dialog box, wake for what it says "The parking brake is not removed then F1 for Help "(the speaker produces a loud sound). You humbly click on "OK" button to remove the message box, then again trying to open the main menu, but the car just sends you sound. Finally, realizing that the fact that dialog box "Speed" still appears, you click on "Cancel" button to remove it. You open the menu "The parking brake and put away the box" Enable ". Then again you Opens "Let's go." And once again receive the message loud sound) that you must first choose a direction in the menu "Switching speed." At this point, you decide that you may be better to go to work on foot ... " In general, it is clear that the interface must be understandable, but not intrusive. Does not necessarily make a shell-like any of the existing interfaces, though GUI framework are common to all and set out a long time. Must proceed from the specific machines - memory consumption, speed, convenience. At the same time, you must provide a single interface to avoid as on Linux. On it there are several windows Shells and sets of programs running under a specific shell. Must be enabled in the kernel and the GUI provide third-party programmers to write their own shell or empower the standard. 4) File System. It is a logical nadurovnem hardware-level media. Physical parameters media may differ, but the logical structure to remain constant, as well as vice versa - a physical structure and different logic. Sufficiently large number of different file systems is a serious problem of compatibility and portability. You can also go the way of Unix: the file system alone. It is determined by two basic concepts: there is nothing except the files in the files there is nothing but data. Let me explain first concept. All areas of the disk, including system area and directory, represented as files. But the second concept is a reflection of the first, but already at the level of data in files. Also, the main feature of this file system, originally known as s5fs, is the absolute tree-file structure. You may I ask: what about the same MS-DOS? There, too, a tree-like filesystem. Yes, I agree with you I agree, but the point is that such systems tree is constructed for each logical drive. In all s5fs differently. Is the main tree, usually located on the system section. To gain access to other sections and other drives, it is necessary to mount a file system to the main tree. Usually it goes like this: create an empty folder, and it is associated partition. File System hide these transitions for applications and creates the feeling that All files are on one disc. In fact, they can even physically located on different machines, the network serves as a conduit data. Especially, this file system, or rather its The logical structure is very compact. In addition, the file system provides a single interface for working with files and for working with streams, and other input devices and output. For example, the screen can be represented as a file and It will display all the information in the teletype mode. That is, in principle, and all I wanted to tell you about operating systems. And now, doing their duty:) I, as requested by the editorial board, talking about his attempt to create operating system. I say this about the project ChAOS. Home work on it just coincides with the onset of the reflection What about the OS on the Spectrum. Well, one can not just talk, it is necessary try, as it will work in practice. That tasted. First was implemented multitasking kernel. It works on scheduling algorithm based on a circular, not too effective, but the most simple. Also have been written procedures scheduling and memory window envelope. Deposits with disks, you can read the whole file from the disk and byte-oriented, write the whole file to disk. So, I could start earlier created and saved your application. On this layout, debugged many algorithms and test theories. It turned out preemptive multitasking real-deal. Everything works, of course, is not it quickly as hoped, but faster than expected. In the process develop a new algorithm was tested dispatch based on priorities. But sharpened by the circular algorithm structure of the system has not given the full test this algorithm, however, and so it seemed pretty good results. For interest, I sent this work to Dima Bystrov aka Alco. It was he told about it all Spectrum population. Some time later, I started from scratch to write a different system in that he tried to collect the best from the old version and make a lot of new. At the core was built two modes of dispatching CPU time - the circular and priority. Manager memory was old, but expanded its capabilities. But Lack of time and the emergence of new and more sensible ideas - modular structure - made me long to suspend this project. Now all incoming ideas are written in lyricist for further deliberation and implementation. Also improved Modular support until at compile time. Now gather ideas, and is accumulated material on the new version system. Work is conducted in conjunction with Maxim Fomkin (MaXx Fomkin). To tell yet about this new project did not want but I can say that apart from the world vindouz, spektrumistam get acquainted with the fascinating world of Unix and Linux:). With all questions, requests, please contact the following addresses: 347924 Russia, Taganrog, growth. reg., ul.S.Lazo, 7, kv.54 Gavrilov Vitaly Dmitrievich e-mail: vitamin_caig@mail.ru
Other articles:
Similar articles:
В этот день... 21 November