You are on page 1of 6

INFO2050

SD: Security

Project 2 – Software, O/S and Processing Hardware Architecture

Student: Patricia Cortezzi


Student ID: 8044182

To be done in your project groups. The answers should be your own work – expressed in
your own words. Please don’t consult across groups, unless you are told you may do so.
Cite any references you use. Where applicable, provide screenshots and diagrams, but
please cite your sources. The answers should be well explained – the report you provide
should be completely professional.

For the due date, see the schedule.

Programming Language Architecture

1. Explain the evolution of 1st, 2nd and 3rd generation programming languages.
Explain the terms low and high level languages. (10 marks)

The first generation of programming language is the binary one, with just zeros and
ones, and it was designed by hand and then transferred to a computer by using a punch
card. The second generation is a way to describe Assembly code, which is a low-level
language that uses mnemonic codes (e.g. LDA for load and STA for store) of almost plain
English so it can be easier to read and write. Each line of assembly can be converted and
replaced by the equivalent one line of machine code. Third generation came because even
though Assembly code is easier to read than machine code, it’s still not straight forward
to perform conditionals, loops and classes, and writing large programs can be a slow
process. One line of third generation code can produce many lines of machine code, and
that can save a lot of time when it comes to programming more complex features, so they
are called high-level languages.
Low-level programming languages are extremely close to machine languages (also
called Assembly languages), more appropriate for developing new operating systems or
writing firmware codes for micro-controllers, they are faster to process and return the
output, a code written for one assembly language is impossible to run on another. At the
same time, with high-level languages the programmer can write applications that are
portable across various platforms, and is independent of any architecture, they are easy to
understand, user-friendly, but high-level languages are also slower because they have a
lot of abstractions and layers of code before they reach the hardware itself.
2. What are the different kinds of language translators? Explain.(5 marks)

There are several types of translators, but the main three are compiler, interpreter and
assembler.
Compiler translates high-level languages into machine code, produces an executable
file of machine code, error reports are produced once entire program is compiled (and
these errors can cause the program to crash), compiling may be slow, but the resulting
program code will run quick (directly on the processor). In addition, one high-level
language statement may be several lines of machine code when compiled and compiled
programs no longer need the compiler.
Interpreter temporarily executes high-level languages, one statement at a time (does
not produce an executable file of machine code), error messages are produced
immediately and they stop the program at that point, it runs through the interpreter (IDE),
so it may be slow to perform some iterations, and interpreted programs cannot be used
without the interpreter.
Assembler translates low-level assembly code into machine code, one low-level
language statement is usually translated into one machine code instruction, assembled
programs no longer need the assembler and an executable file of machine code is
produced.

3. “Machine Language” may have been so named because it is the one closest to
the architecture of the programming language. However, the notion of
machine language also has another consequence – what is it? Hint: What
advantage do the 3rd gen languages have over machine languages with respect
to platform? (5 marks)

Machine language is the basic low-level programming language written in binary


(code of 0s and 1s) designed to be recognized by a computer. A machine language is
designed in terms of execution by the hardware of the computer, while a high-level
language is an easy, reliable, and efficient way to express the creativity of a programmer
into commands that a computer will understand. The task of programming using binary
code would be complex and arduous, resulting in programs that would be difficult to
read, check for errors, or debug, and very lengthy as well. This can easily result in errors
during programming, and the whole process could become very time-consuming and
costly (e.g., a simple subtraction between two numbers would require more than ten
instructions in machine language).

PS: I’m not sure if it’s what you asked for. Seems a bit redundant question.

4. What does WORA mean? How did the new method of translation of Java
applications (web applications and applets) facilitate WORA? (5 marks)
The acronym WORA means "write once, run anywhere". Using WORA, a Java
program could be developed on any device, compiled into a standard bytecode (pseudo
machine language), and be expected to run on any device equipped with a Java virtual
machine (JVM). With that, the same code could run on multiple platforms, as long as
they had a machine-specific JVM. , and this can save software developers the effort of
writing a different version of their software for each platform or operating system they
intend to deploy on.

5. In a Java application, what is the value for having both servlets and JSPs?
What is the life cycle of the JSP? (5 marks)

By having servlets and JSPs in your Java application, you are using the MVC (Model,
View and Controller) architecture pattern, where servlets are the controllers and JSPs will
be the view part. By using the MVC pattern, a Java application can have faster
development process, provide multiple views and modifications do not affect the entire
model.
The JSP life cycle is the process from its creation until the destruction, and it is made
of compilation, initialization, execution and cleanup. On compilation, the JSP checks to
see whether it needs to compile the page. If the page has never been compiled, or if the
JSP has been modified since it was last compiled, the JSP engine compiles the page.
Initialization is performed when a container loads a JSP by invoking the jspInit() method
before servicing any requests. Execution is the sum of all interactions with requests until
the JSP is destroyed. Cleanup is when a JSP is being removed from use by a container.

Processing Hardware Architecture

1. Explain the various components of the CPU. Your discussion should include
the CU, ALU, the various types of registers, and the relevance of the clock to
the functioning of the CPU. (10 marks)

The CPU components are control unit (CU), arithmetic logic unit (ALU) and
registers. The ALU performs arithmetic and logical operations, CU extracts instructions
from memory and decodes and executes them, calling on the ALU when necessary, and
register is one of a small set of data holding places that are part of the computer
processor.
A register may hold an instruction, a storage address, or any kind of data (such as a
bit sequence or individual characters). A processor typically contains multiple address
registers, and they improve computer performance by speeding up simple operations. A
data register acts as a buffer by storing the data being transferred to and from the
immediate access storage and allowing the processor and memory units to act
independently without being affected by minor differences in operation. The instruction
register holds the instruction currently being executed or decoded, and each instruction to
be executed is loaded into the instruction register which holds it while it is decoded,
prepared and ultimately executed.
The CPU clock is needed to synchronize all components on the motherboard, which
means they all do their work only if the clock is high; never when it's low. Because the
clock speed is set above the longest time any signal needs to propagate through any
circuit on the board, this system is preventing signals from arriving before other signals
are ready and thus keeps everything safe and synchronized.

2. What purpose does the main memory of the computer serve? How does it
relate to the hard drive? How does the size of the address bus impact on the
size of memory (5 marks)

The main memory (RAM) refers to physical memory that is internal to the computer.
Since the computer can manipulate only data that is in main memory, every program you
execute and every file you access must be copied from a storage device into main
memory. The amount of main memory on a computer is crucial because it determines
how many programs can be executed at one time and how much data can be readily
available to a program.
Using a metaphor of a desk as your system, hard drive is the actual storage, like a
drawer of the desk, while RAM is the workspace of the desk. An address bus is a series of
lines connecting two or more devices) that is used to specify a physical address, and the
size of the address bus determines the amount of memory a system can address. They are
closely related because if you have a busy workplace and a desk with papers crammed
into every drawer, when you try to move something off the work surface there is no place
to put it, so the CPU actually uses hard-drive space to organize RAM contents.

3. Explain how a simple low level program, say in assembly language, would
work, and how the components of the processing hardware are involved. (10
marks)

A low-level program is a complete hardware oriented programing language that


consumes less number of clock cycles and takes less memory as compared to the high-
level programming language. It works with the assembler converting the assembly
language to binary language and storing it the memory to perform the tasks. The
assembly level programming is based on the memory registers (the main part of the
microprocessors and controllers), which are located in the memory that provides a faster
way of collecting and storing the data.

4. What is “memory swapping”? (5 marks)

Memory swapping is a memory reclamation method wherein memory contents not


currently in use are swapped to a disk to make the memory available for other
applications or processes.
Operating System Architecture

1. What are the purposes of the operating system? (10 marks)

An operating system has three main functions:


 Manage the computer's resources, such as the central processing unit,
memory, disk drives, and printers;
 Establish a user interface, and
 Execute and provide services for applications software.

2. What is the BIOS? (5 marks)

BIOS is the acronym to “Basic Input/Output System”, which means it is a non-


volatile firmware used to perform hardware initialization during the booting process
(power-on startup), and to provide runtime services for operating systems and programs.

3. What is a kernel? ( 5 marks)

Kernel is the core component of an operating system that uses interprocess


communication and system calls to acts as a bridge between applications and the data
processing performed at the hardware level.

4. What are “system calls” and how do they relate to the operating system, and
also secure computing?

System calls are the programmatic way in which a computer program requests a
service from the kernel of the operating system it is executed on, and may include
hardware-related services, creation and execution of new processes, and communication
with integral kernel services such as process scheduling. The system calls check that their
caller (e.g. a user process) has the appropriate authorizations to perform the actions they
represent, also considering the values of the parameters, and the exact mechanisms
depend on the kernel and the authorization model(s) it uses.

5. What happens in the boot process? Why should it work this way? (5 marks)

Your operating system (OS) is stored on your hard drive but it does not operate from
the hard drive itself, because secondary storage devices are slow. So, the OS is loaded to
the main memory (RAM), which is fast, and can be processed by the CPU to perform
various tasks as it does. Then, booting involves loading the OS to the main memory.
When you power on your system, the first thing which fires up is the BIOS, and it is the
BIOS that loads a small program from a special location on your hard drive called the
bootloader. It is now the bootloader, which is responsible for loading the kernel, and
primary processes, which eventually load other processes, and you are landed to the login
screen with a bunch of processes working in the background.

Software Application Architecture

1. Explain memory models for software applications. Refer specifically to the


text Segment, Data Segment, Heap and Stack. (10 marks)

Heap: is the segment where dynamic memory allocation usually takes place, and it
begins at the end of the BSS segment (uninitialized data segment) and grows to larger
addresses from there.
Stack: stack area traditionally adjoined the heap area and grew the opposite direction.
When the stack pointer met the heap pointer, free memory was exhausted. The stack area
contains the program stack, a LIFO structure, typically located in the higher parts of
memory, and it grows toward address zero. A “stack pointer” register tracks the top of the
stack; it is adjusted each time a value is “pushed” onto the stack.
Text Segment: is one of the sections of a program in an object file or in memory,
which contains executable instructions. As a memory region, a text segment may be
placed below the heap or stack in order to prevent heaps and stack overflows from
overwriting it.
Data Segment: is a portion of virtual address space of a program, which contains the
global variables and static variables that are initialized by the programmer. It’s not read-
only, since the values of the variables can be altered at run time.

References:

https://en.wikibooks.org/wiki/A-
level_Computing/AQA/Computer_Components,_The_Stored_Program_Concept_and_th
e_Internet/Fundamentals_of_Computer_Systems/Generations_of_programming_languag
e (visited in Jan 30, 2019)

https://www.computerscience.gcse.guru/theory/translators (visited in Jan 30, 2019)

https://www.tutorialspoint.com/jsp/jsp_life_cycle.htm (visited in Jan 30, 2019)

https://www.cnet.com/news/understanding-ram-versus-hard-drive-space-via-an-analogy/
(visited in Jan 30, 2019)

https://en.wikipedia.org/wiki/System_call (visited in Jan 30, 2019)

https://www.quora.com/What-exactly-is-the-booting-process (visited in Jan 31, 2019)

https://www.geeksforgeeks.org/memory-layout-of-c-program/ (visited in Jan 31, 2019)