Product SiteDocumentation Site

B.3. آلية العمل الداخلية للحاسوب: طبقات الحاسوب المختلفة

يتم التعامل مع الحواسيب بأسلوب تجريدي غالبًا، وتكون الطبقة الظاهرة منه أبسط بكثير من التعقيد الداخلي للحاسوب. ينتج هذا التعقيد جزئياً عن عدد القطع المكونة للحاسوب. إلا أننا نستطيع تصنيف هذه المكونات في طبقات، حيث تتعامل كل طبقة مع الطبقة التي تليها أو تسبقها فقط.
يمكن للمستخدم العادي أن يتدبر أمره دون معرفة هذه التفاصيل… طالما أن كل شيء يعمل على ما يرام. لكن عند مواجهة مشكلة مثل ”الإنترنت لا يعمل!“، فالخطوة الأولى هي تحديد الطبقة التي تسبب المشكلة. هل تعمل بطاقة الشبكة (عتاد)؟ هل تعرَّف عليها الحاسوب؟ هل تستطيع النواة لينكس رؤيتها؟ هل إعدادات الشبكة مضبوطة بشكل صحيح؟ يعزل كل واحد من هذه الأسئلة طبقة مناسبة ويركز على مصدر محتمل للمشكلة.

B.3.1. أعمق طبقة: العتاد

Let us start with a basic reminder that a computer is, first and foremost, a set of hardware elements. There is generally a main board (known as the motherboard), with one (or more) processor(s), some RAM, device controllers, and extension slots for option boards (for other device controllers). Most noteworthy among these controllers are IDE (Parallel ATA), SCSI and Serial ATA, for connecting to storage devices such as hard disks. Other controllers include USB, which is able to host a great variety of devices (ranging from webcams to thermometers, from keyboards to home automation systems) and IEEE 1394 (Firewire). These controllers often allow connecting several devices so the complete subsystem handled by a controller is therefore usually known as a “bus”. Option boards include graphics cards (into which monitor screens will be plugged), sound cards, network interface cards, and so on. Some main boards are pre-built with these features, and don't need option boards.

B.3.2. The Starter: the BIOS or UEFI

العتاد وحده غير قادر على تنفيذ مهام مفيدة دون البرمجية المناسبة التي تقوده. إن التحكم والتفاعل مع العتاد هو هدف نظام التشغيل والتطبيقات. وهذه بدورها تحتاج إلى عتاد سليم لتعمل.
This symbiosis between hardware and software does not happen on its own. When the computer is first powered up, some initial setup is required. This role is assumed by the BIOS or UEFI, a piece of software embedded into the main board that runs automatically upon power-up. Its primary task is searching for software it can hand over control to. Usually, in the BIOS case, this involves looking for the first hard disk with a boot sector (also known as the master boot record or MBR), loading that boot sector, and running it. From then on, the BIOS is usually not involved (until the next boot). In the case of UEFI, the process involves scanning disks to find a dedicated EFI partition containing further EFI applications to execute.
The boot sector (or the EFI partition), in turn, contains another piece of software, called the bootloader, whose purpose is to find and run an operating system. Since this bootloader is not embedded in the main board but loaded from disk, it can be smarter than the BIOS, which explains why the BIOS does not load the operating system by itself. For instance, the bootloader (often GRUB on Linux systems) can list the available operating systems and ask the user to choose one. Usually, a time-out and default choice is provided. Sometimes the user can also choose to add parameters to pass to the kernel, and so on. Eventually, a kernel is found, loaded into memory, and executed.
The BIOS/UEFI is also in charge of detecting and initializing a number of devices. Obviously, this includes the IDE/SATA devices (usually hard disk(s) and CD/DVD-ROM drives), but also PCI devices. Detected devices are often listed on screen during the boot process. If this list goes by too fast, use the Pause key to freeze it for long enough to read. Installed PCI devices that don't appear are a bad omen. At worst, the device is faulty. At best, it is merely incompatible with the current version of the BIOS or main board. PCI specifications evolve, and old main boards are not guaranteed to handle newer PCI devices.

B.3.3. النواة

Both the BIOS/UEFI and the bootloader only run for a few seconds each; now we are getting to the first piece of software that runs for a longer time, the operating system kernel. This kernel assumes the role of a conductor in an orchestra, and ensures coordination between hardware and software. This role involves several tasks including: driving hardware, managing processes, users and permissions, the filesystem, and so on. The kernel provides a common base to all other programs on the system.

B.3.4. فضاء المستخدم

Although everything that happens outside of the kernel can be lumped together under “user space”, we can still separate it into software layers. However, their interactions are more complex than before, and the classifications may not be as simple. An application commonly uses libraries, which in turn involve the kernel, but the communications can also involve other programs, or even many libraries calling each other.