The Process Of Programming Computer Science
Generally a programmer writes a program using a particular programming language. When the programmer writes the program, it was in source code most probably High Level Language (HLL). This source code is the only language that is readable by human. Besides that, source code or programming language is easy to write and maintain. As a final stage, the written code or program has to compile so that it will convert to machine readable form or more generically machine language (often having binary form) in order to make it executable. Most programmers nowadays prefer HLL rather than Low Level Language because it is easier to write and maintain as well. A utility tool called compiler was first invented by Grace Hopper in 1952 for A-0 programming language. Compiler converts High Level Languages into target programs. Once these source codes which were in High Level Languages converted into target programs, the program can be executed by the user. The following are the phases involved in compilation process.
In compilation process, the first phase or step is taken place at lexer. It scans all the source codes written by the programmer earlier. It reads all the codes character by character at a time and performs a process called lexical analysis. As the lexer reads the characters, it will translate all the codes and characters into reserved words, (computer commands, characters that computer understands). The set of possible character sequence usually consists of regular expressions. The lexer cancels all the spaces and remarks included by the programmer. Once the lexer finished assembles the codes into computer commands, it generates a code token. A token is a string of characters which categorizes the commands to a symbol. The lexer assumes a string as a variable when it doesn't form a reserved word as a result generates a variable token. Then, the lexer finds a numeric character which doesn't form reserved words; the lexer then converts it into an integer and produces an integer token. Finally, the result generated by the lexical analysis which is the stream of token that identifies all the commands or codes in the program.
Parser (Syntactic analysis)
Sequence showing parser flow
Here comes the second stage of compilation process. This second process is called parser. Parser performs syntactic analysis which will analyze the streams of token that was created by the lexer previously. In this phase, the parser will transfigure the tokens into node on a syntax tree. It will checks for correct syntax with the reference of context-free grammar which defines the components that can make up an expression and sequence it should appear. Then, a data structure often called syntax tree which represents the program's overall logical flow were build. Syntax tree represents the structure of the source code which was later converted into tokens. The tree is then converted into a linear sequence of instructions commonly called intermediate language. The top upper part of the syntax tree is called the program and the nodes that pass result to it are called routines.
Diagram showing syntax treeparser.PNG
Third part of compiler is code generator. It converts the intermediate representation of source code which was generated by parser previously. It analyzes the whole syntax tree and generates machine codes that can be executed by machine. The code generator includes the variables and values found in each node into the template. The template most likely to be "Ifâ€¦.Elseâ€¦." statement template. After each node filled, here comes the machine coding part. These templates are added to the string of binary numbers that compose the machine language thus makes the program or software executable as well which can then run by the user.
Diagram showing template samplesTEMPLATE.PNG
The final phase of compilation process is code optimization. In this phase, the code optimizer will contrive for any repetition codes and eliminates it to make the program execute faster besides ensures all the codes generated are correct and valid. The optimizer will make some of the aspects to work more efficient, capable and uses less memory storage as well. And finally, the program is now ready to execute on targeted machine as well as it was compiled to machine language.Question b (i)
Operating system is a core software on a computer that provides instructions and executes programs or software. The operating system acts as intermediary between application software and hardware. It performs many functions and translates the commands from the hardware or user to computer commands that understand by the computer. Operating system is often founded in computers, mobile phones, PDAs, Tablet PC, and many more. Some of the most common operating system widely used is Microsoft Windows, Macintosh, Linux, and Unix.
Diagram showing operating system placement
Operating system has very wide functions. It can run any software and applications loaded into it. The user operates within the operating system to execute particular software. Functions of operating system are discussed here.
Firstly, the operating system can execute the commands made by the user as well. The user executes a program or software with just a single click on the mouse. The operating system then launches the software and be devoted to the user. The user then continues doing the tasks with the program as the operating system continues to operate and function according to the user needs.
Figure shows the operating system interfaceos.PNG
For an example, when the user wants to type in some text and print it out, the operating system opens the particular program such as word processor software like Microsoft Office, Open Office, Notepad, and Wordpad. As the user types the words and works with the software, the operating system continues to provide a stable and constituent way for application to deal with the software itself.
Besides that, the operating system works as the "middle man" as it manages the process occurs between hardware and software. This is one of the major function of the operating system. This is due to the resources needed by the input devices. Functions of input devices depend on the operating and the capability of central processing unit (CPU). This is due to the memory demand, storage, input/output (I/O) bandwidth for their own purpose. In this case, the operating system manages to makes sure that each application gets the enough resources while controlling the other applications as well.
In addition, the operating system provides an interface for "drivers". Driver is a software that understands and operate within the device including input or output device. The driver translates the commands from the user and operating system into commands understood by the device that it interfaces with. It also translates the responses from the user and operating via driver that installed. Here, we can conclude that, operating system provides user interface to devices including input and output devices to function accordingly to the user.
The operating system also detects problems and system failures that causes problems in processing. In order to overcome this problem, operating system comes with huge variety of system tools. This system tools is a utility or software that performs additional tasks such as
cleaning the hard disk, memory management, display optimization, computer performance monitoring, debug problems, perform maintenance for the system files, defrag files and folders stored in hard disk drive, disk cleaning, CPU core temperature monitoring and many more. The operating system executes these utility software as executed by the user. It provides the important functions as it is the only tool that maintains the operating system and other applications installed to be in good condition and functionality. As an example, disk defragmenter runs to defrag the files and folders in the hard disk to make sure the computer runs faster and more efficiently. As a conclusion, we can say that, operating system provides system utility software and execute it to ensure the computer's performance is maintained as well.
Moreover, the operating system functions as a caretaker. This is because; the operating system makes sure that the data is saved in right place. When the user saves a file or folder from a source might be removable storage or anything, the operating system will save the file or data in the place the user wants to save it. So, this enables the user to locate and open the file or the data next time easier and faster. The operating system offers both the user and application programs to rename a file, delete a file, save as a file, load a new file and thus execute or open the file or application immediately. The operating system also takes care of the files as it provides the system restore service. System restore is a special software or utility bundled with every operating system. It allows rolling back any changes made to the system as well. It allows rolling back changes that has been made by the user such as installed programs, incompatible drivers, or registry keys that causes serious damage or system malfunction. System restore will create restore point automatically for every changes that has been made by the user. So, next time when the system malfunction or didn't function properly, the operating system will execute system restore to automatically restore to the previous state of the system.
Diagram showing a bunch of computers connected to the same networkFurthermore, the operating system also allows users to communicate from one computer to another. This is called networking. Networking allows user to communicate, share data, files, information, programs, hardware such as printers, modems and hard disk. The operating system needs to makes sure that different computers can understand the commands each other when they are connected in the same network. Besides that, the operating system also provides system security when they are connected through network. The operating system will ask for a password before it allows other computer to connect to the network. The operating system also includes some filters that allow only certain computers to connect to the network as well. computer-hardware-and-networking2.jpg
The operating system also enables the user to do multitasking. It means, operating system can perform multiple tasks at each time. It allows the user to work more than one program each time or allows more than one user to share information. In addition, the user can drag and drop a folder or file from one window to another window when the operating system performs multitasking operations. drag and drop.PNG
Picture showing multiple windows opened at each timeQuestion b (ii)
Operating system gets loaded into computer's main memory or random access memory (RAM) by booting process. Booting process starts once Basic Input Output System (BIOS) takes charge. BIOS configuration is unchangeable because it is already loaded into Read Only Memory (ROM) chip. Contents and configurations stored in ROM couldn't editable or modifiable as the name suggests READ ONLY MEMORY. Then, the BIOS will execute a power-on self test (POST) to determine and ensure all the computer hardware is functional. Then BIOS will look for boot files on each drives that are installed on the computer such as disk drive, diskette drive and hard disk drive. The BIOS will look for the bootable file one by one as it will determine in the floppy drive first, if bootable file didn't located, it will continue to search for the bootable file in hard drive. Once founded, the data or information contained will be copied to RAM often called Master Boot Record. The boot record is then loaded into hexadecimal address 7C00 in RAM. The boot record then loads the system file that founded in hard disk as the system file loads operating system files into RAM. The first file that is loaded is the system configuration file that response and sends commands to device driver e.g, display driver or sound driver that was installed in the operating system. At last, windows or operating system is now loaded into RAM. The operating system is now successfully loaded. The user can perform tasks and works with the application.
Article name: The Process Of Programming Computer Science essay, research paper, dissertation