Computer Technologies and O/S Uni notes

FIT9018: Week 12

Week 12, still on hardware, look primarily at processors, memory and system performance.

Major factors in determining system performance (note software design struggles to make use of current hardware capabilities)

  • CPU processing speeds
  • Multiple thread processing
  • Multiple CPUs
  • Distributed systems
  • Wider/Faster Instruction paths (buses)
  • Faster secondary memory access
  • More/Faster memory including RAM and cache
  • Better memory/processor management (ie Virtual Memory OS)

Note that CPU clock speeds are determined by the manufacturer using non-standardized instructions. Thus box label clock speed should b ‘taken with a pinch of salt’.

More important is the instruction set architecture aka CPU architecture. At present there are two major architecture types:

  • CISC  – Intel/AMD [Complex Instruction Set Computers]
    • Small number of registers, large number of specialized instructions
  • RISC – SUN Sparc [Reduced Instruction Set Computers]
    • Large number of registers, small number of stored instructions

RISC takes heed of the fact that most programs only use about 10 of the 200 stored instructions. At present almost all processors with the exception of Intels x86 range utilized RISC architecture.

Techniques for increasing CPU performance:

  • fetch-execute operations made concurrent (can both be conducted at the same time)
  • Pipelining overlapping fetch and execute cycles
  • Parallel executions

This techniques result in scalar and super-scalar processing:

Without the above techniques 28 cycle would be required

Cache is another key technique for improving computing performance. By having a small amount of memory between the CPU and primary memory

Computer Technologies and O/S

FIT9018: Week 11

A quick summary of week 11 which was a brief and perhaps dated review of storage devices:

  • Magnetic Disks
    • Direct Access Storage Devices (ie Hard disks/Floppy Disks) –  Organized by sectors, tracks and cylinder heads
  • Total (Disk) Access time – Total time it takes to read a piece of data – seek time + rotational delay + Data transfer time
    • Seek Time – time to position head over required cylinder (usually 4-8ms)
    • Rotational delay – time for desired sector to pass under the head (avg. 4ms)
    • Data Transfer time – >1ms
  • Magnetic Tape – Cheap sequential storage medium (only used for logging these days)
  • Optical Storage – CD-ROM/DVD/HD-DVD/BlueRay
  • Solid State –  USB Keys/SolidState Hard-drives (more information:
Intel's SSD range (quickly coming down to a reasonable price)
Computer Technologies and O/S

FIT9018: Week 10

Week 10’s lecture was a continuation from Week 9’s introduction to shell scripting. The tutorial this week was closely correlated to the lecture material for weeks 9 and 10.

Ubuntu Shell

Pearl of the Week: Test function in shell scripts. + /dev/null (trash bin for script outputs)

if [ $var1 = $var2 ]
echo var1 and var2 are the same
echo var1 and var2 are different

We had a chance to make some scripts based on the constructs and operators that we learnt from the lecture:

[To be uploaded]

A basic but detailed guide to shell scripting:

An advanced guide to shell scripting:

Computer Technologies and O/S

FIT9018: Week 9

Week 9 saw Andy delve further into utilizing the Unix shell followed by a tutorial on setting up the Apache HTTP server.

On the unix shell, we explored shell scripts. The basics that we covered:

Pearl of the week – Common shell script errors:

[-z “$x”] error : no space near the [ ]’s
[ “$x”=”abc“ ] error : no space around =
y = 20 error : extra spaces around =

  • # -> comment character
  • x=y -> assign vaiable (no space)
  • shell keys words stored in .profile
  • Standard variables:
    • $$ the process id of the shell
    • $0 the name of the shell script (if applicable)
    • $1…$9 $n refers to the nth command line argument
    • $# contains the number of arguments
    • $* a list of all the command line arguments
    • $? Exit status (more on that shortly)
  • ; -> End of line
  • if, then, else, for, for in, if-then-elif, while, until, break continue, case, trap.

Computer Technologies and O/S

FIT9018: Week 8

Week 8’s lecture returned to the UNIX shell for some more in depth analysis. The tutorial was dedicated to Squid Proxy Server and how to run it from shell.

 First off, the lecture on Shell Scripting:

What happens when you type a command in shell

Computer Technologies and O/S

FIT9018: Week 7

Andy presented another high paced lecture this week, the theme was Deadlock and Inter-Process Communication. This is a continuation of the Process Management topic from last week.

As a recap:

  • Deadlocks: Can occur on any multitasking O/S where a single process is given exclusive access to a file, device or resource. Detailed conditions:
    • Mutual Exclusion – One process can hold a resource exclusively
    • Hold and Wait – A process can request a new resource over time whilst still holding other resources.
    • No pre-emption – resources can only be released by the program that is holding them
    • Circular Wait – 2 or more processes waiting for resources held the other processes.
Computer Technologies and O/S

FIT9018: Week 6

Process Management was the theme of Andy’s lecture this week. Specifically, a definition of processes and how they intersect with the CPU, Process Control and Process Scheduling Algorithms.

  • Processes – Simply a program execution.
  • Process Control –  an import part of a multi-tasking O/S (modern O/S’s and CPUs enable multithreading)
  • Information about processes is store in the Process Table by the O/S

The lecture glazed over the process management system stopping at:

Computer Technologies and O/S

FIT9018: Week 5

5th Week Lecture – Virtual Memory

Andy Cheng’s lecture this week was a whirlwind tour over the definition and major issues of Virtual Memory.


Virtual Memory enables programs running on an O/S to interact with what to them is a contiguous memory source. That is, program instructions and resources can be loaded to Virtual Memory addresses and a program can easily access them with logical addresses. The illustration above shows a simplified concept of Virtual Memory.

There are two major implementations for Virtual Memory:

Computer Technologies and O/S

FIT9018: Week 4

This weeks lecture was a continuation of ‘Operating System II: File Management”. Most of the concepts covered in this weeks lecture I had looked at in last weeks review.

Some of the new points introduced were:

  • When a file is accessed it has four id’s (I assume an example is real and sudo):
    • a real user id
    • an effective user id
    • a real group id
    • an effective group id
  • Standard Input, Output, Error – Every time a shell is started. 3 files are opened automatically:
    • stdin, (keyboard), 0
    • stdout, (screen), 1
    • sterr, (screen), 2
  • Example of how inode numbers and logical directory structures work.
  • How rwx Permissions work with directories: (Pearl of the Week)
    • Read- Processes can list names and subdirectories within directory
    • Write- Processes can alter the directory (create and remove files). To modify files write permission must be applied to the file.
    • Excecute- Allows the user to cd into the directory. To open a file or excerpter a program a user must have execute permission on all directories leading to the files absolute path name.
  • Hard and Soft(Symbolic) Links
  • Locks (not covered in detail yet)

Pearl of the week: vi/vim text editor

$ vi myfile
$ vim myfile

In the tut we worked with vi/vim text editor which is a tool I had struggled with before and had never bothered to read the tutorials on.

It turns out that it is a damn good editor as it is very very quick and easy once one becomes even moderately sufficient (2-3 hr tutorial). One of the primary advantages is that it runs within a command prompt environment so can be used via SSH with ease.

Some of the handy commands learnt in the tutorial are:

  • i -> insert mode
  • : -> comand mode
  • esc -> back to normal mode
  • CTRL + G -> End of the doc
  • /prase -> find phrase
  • n -> next phrase down
  • N -> next phrase up
  • :%s/word1/word2/gc -> replace all word1 with word2, gc adds confirmation for each occurance
  • u -> undo
  • d -> delete
  • put -> put was what just deleted
  • v -> visual select
  • w -> word (dw -> delete word)
  • $ -> end of line (d$ delete from cursor to end of line)
  • :set tabstop=2 -> set tab distance to 2
  • :set number -> show line numbers
  • :set nonumber -> hide line numbers
  • :1,4d -> delete lines 1,2,3,4

There are a great deal many useful examples of these which i shall add in as I use them.

Computer Technologies and O/S

FIT9018: Week 3

Andy Cheng presented the lecture titled “Operating Systems II: File Management” this week. In basis File Management systems allow users to store information in units called files, File systems provide a logical view for the user whilst hiding the physical view which is not interpretable by the average human.

  • Ordinary Files – executable, text, source code, etc.
  • Directories – contain Ordinary files and subdirectories (assist with Logical View)
  • Special Files – represent devices and other advanced file types.

We did not get into the file types in detail during the lecture or the tut however the file type and their characters (which can be view using ls -l):

  • – -> regular file
  • d -> directory file
  • b -> buffered special file (ie: disk drive)
  • c -> unbuffered special file (ie: terminal)
  • l -> symbolic link
  • p -> pipe
  • s -> socket

Absolute and Relative paths, self explanatory.

The lecture was cut short as we had to spent some time finishing the previous weeks slides so we did not really get into the chmod analysis which is responsible for permissions (I have had experience with this command as it is important on Unix based hosting for updating write permissions on config files). Basically the command is divided into User/Group/Others -> read, write and execute. A quick hand way for setting permissions is:

The octal (0-7) value is calculated by adding up the values for each digit

read = 4 ,write = 2, execute = 1,
User (rwx) = 4+2+1 = 7
Group(rx) = 4+1 = 5
World (rx) = 4+1 = 5
chmode mode = 0755

$ chmod 755 myfile – would be the command.

Pearl of the week: In all Unix operating systems all entities are treated as files (I assume this is related to the monolithic kernel design)

In the tut we got into working with the shell, a summary of some of the commands we covered below:

  • Print working directory -> pwd
  • Tab completes file name (or to fork where multiple possible values occur)
  • chmod

My favored site with listings of shell commands is: I find it the quickest and easiest for learning and look up.

To get better at command-line interface the key is regular practice. I am currently running Ubuntu on my home pc, but rarely use the shell unless testing programs. It is a good habit to get into using it.

After doing some practice it appears that using wildcard for the ls command is not very useful for find particular files in subdirectories. For example if you wanted to find all of the .ape files in your My Music folder, ls -R *.mp3 would not work. Instead one would need to use:

find ~/My Music/ -regex ".*\(mp3\)$" //find all .mp4 files
find -regex ".*\(.ape\|\.mp4\)$"  //find all .ape and .mp4 in relative directory and subdirectories