CSSLP Tutorial: Module 04,Part 02 – Architecture Of CPU

CPU Architecture

For this article, we are going to delve into architecture of CPU (Central Processing Unit) of a computer only at its surface.  This is not a language article or a type of article where we’d need to count the pins for example, on the processing unit. We are just trying to understand some of the basic elements of it like arithmetic logic unit, control unit, the registers of the CPU, what each of these elements do to add to the whole architecture as well as understanding some of the elements of memory. The next section is where we’ll explore more about the aspects of memory. First, let’s explore more about computer architecture.

There are four main functions of the CPU.  There’s fetch, decode, execute, and store.  The first is fetch and this is where the control unit essentially gets the instruction, it “fetches” it out of the application via memory. Sometimes, there’s even a pre-fetching process.  This is when the cache memory goes out and anticipates the needs ahead of the actual fetching process.  Regardless, the control unit goes to the memory area to retrieve its instructions. The second function called decode, is when the control unit decodes the instructions and then sends the data to the arithmetic logic unit, or the ALU.   The ALU and the control unit perform whatever operation as called for by the data.  Then the storing of information is in the last mode. The storage will either occur in memory or, more likely, in a register.  There’s a specific area used by the processor and it has very very high speed memory.  It’s where the ALU tends to store whatever ended up happening because of the operation.

For the execution mode, there are five main types.  These include: multi programming, multi-tasking, multi-threading, multi-processing, multi-core processors. 

Multi-programming are those where it just appears as if there are multiple applications open and operating at once, however, in reality only one is actually working at one time.  For example, in Windows 3.1, you could have excel, word or some other but since they were no true actual isolation of these different processes, they were essentially not working and the only functioning page would be the topmost one. So, you couldn’t download something in one application and try to work on something in another. You’d have to finish the download first before you could access another application.  It just seemed as though both programs were open, but because there was no true isolation in the processes, then there was no way to be able to run more than one program at a time. At best, it could be considered as cooperative multitasking.  This is where when one application takes precedence, the other(s) yield to that program.  As a cooperatively multi tasked system relies on each process regularly gives up time to other processes, one poorly designed program can cause the whole system to hang, when can lead to the whole thing sort of being a hazard.

Multitasking is what we got when the OS changed from Windows 3.1 to Windows 95 and that they can actually run multiple programs at the same time.  This was a true multitasking type of environment.  There’s cooperative multitasking which is a bit more like the multi programming, but also there’s preemptive multitasking.  This is where each application is given its own set of resources and then each application is given its own set of memory, access of configuration files, whatever.  So, if one application needs to be ended quickly and individually, the ctrl-alt-delete function now allows for one program to be shut down.  In the cooperative multitasking of Windows 3.1, there wasn’t that ability to shut individual applications down one at a time.

Multi threading is when the operating system can handle more than one thread at one time.  The thread is where you can print in Word, at the same time you can change the orientation, input font differences, colorize font, and so on. Each of those is referred to as a thread.  Having multiple threads at one time can be accomplished with one of two ways. The more traditional means of handling multiple threads is to have a multithreading operating system.  The hardware is generally not able to multi thread still. Another way is by adding on more processors. 

Multi-core processors such a symmetric multiprocessing systems, can be either 8 processors, 32 processors, or 64 processors and so when additional processors, can then multithread not only at software but also at the hardware level, as well.   It can end up being very cumbersome and expensive.  So, there’s another process referred to as having dual core processors, where then the multiple cores are then available for the multithread.  The multiple processor setup is referred to as quad core processor.  We’ve been doing multithreading with the software for years and it’s just recent that the hardware aspect has caught up to the software.

In summary then, there are four main functions of the CPU.  One of those four has multiple types of its architecture as well as multiple functionalities.  The four main CPU functions are fetch, decode, execute, and store.   Of the execution function, there are five main types.  As move up the list, there is an increase in functionality and increase in capability of handling multiple tasks,  where they are being handled all at one time.  They include: multiprogramming, multitasking, multithreading, multiprocessing, multi-core processors. 

The next section is about the modes of the central processing unit, or CPU.  So, when there are multiple levels of accessibility, say for example opening to the internet with a network administrator sign-on as opposed to a lower risk level sign-on, when cruising around forums or chat rooms, the employee would choose the lower risk type of sign-on.  Similarly, with the processor, there is a full access mode known as privileged mode, or sometimes called kernel mode.  The privilege mode has a lot more vulnerabilities to it if employed to work throughout the whole day.  There are just too many access points or capabilities.  So, there’s a way to step back the level of privileges to what’s referred to as a problem state (or user state) mode.  The idea is that the user state allows functionality without an elevation of privileges. It’s like network administrator choosing to use the regular sign-on rather than their full access sign-on, and then both reduce the chances of vulnerability to a threat or attack.  This and more dealing with types of memory is in the next section of the module.