Computer Science Lecturer Test Preparation (Part-4)

Computer Science Lecturer Test Preparation (Part-4)

Computer Science Lecturer Test Preparation Part-1

Computer Science Lecturer Test Preparation Part-2

Computer Science Lecturer Test Preparation Part-3

Computer Science Lecturer Test Preparation Part-4

Types of program errors

We distinguish between the following types of errors:

  1. Syntax errors: errors due to the fact that the syntax of the language is not respected.
  2. Semantic errors: errors due to an improper use of program statements.
  3. Logical errors: errors due to the fact that the specification is not respected.

From the point of view of when errors are detected, we distinguish:

  1. Compile time errors: syntax errors and static semantic errors indicated by the compiler.
  2. Runtime errors: dynamic semantic errors, and logical errors, that cannot be detected by the compiler (debugging).

 Deadlock

A deadlock is a situation in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function.

The earliest computer operating systems ran only one program at a time. All of the resources of the system were available to this one program. Later, operating systems ran multiple programs at once, interleaving them. Programs were required to specify in advance what resources they needed so that they could avoid conflicts with other programs running at the same time. Eventually some operating systems offered dynamic allocation of resources. Programs could request further allocations of resources after they had begun running. This led to the problem of the deadlock.

 BIOS

Short for Basic Input/Output System, the BIOS (pronounced bye-oss) is a ROM chip found on motherboards that allows you to access and set up your computer system at the most basic level. In the picture below, is an example of what a BIOS chip may look like on your computer motherboard. In this example, this is a picture of an early AMIBIOS, a type of BIOS manufactured by the AMI. Another good example of a BIOS manufacturer is Phoenix.

he BIOS includes instructions on how to load basic computer hardware and includes a test referred to as a POST (Power On Self Test) that helps verify the computer meets requirements to boot up properly. If the computer does not pass the POST, you will receive a combination of beeps indicating what is malfunctioning within the computer.

The four main functions of a PC BIOS

  • POST – Test the computer hardware and make sure no errors exist before loading the operating system. Additional information on the POST can be found on our POST and Beep Codes page.
  • Bootstrap Loader – Locate the operating system. If a capable operating system is located, the BIOS will pass control to it.
  • BIOS drivers – Low level drivers that give the computer basic operational control over your computer’s hardware.
  • BIOS or CMOS Setup – Configuration program that allows you to configure hardware settings including system settings such as computer passwords, time, and date.

 IP Address

Every machine on a network has a unique identifier. Just as you would address a letter to send in the mail, computers use the unique identifier to send data to specific computers on a network. Most networks today, including all computers on the Internet, use the TCP/IP protocol as the standard for how to communicate on the network. In the TCP/IP protocol, the unique identifier for a computer is called its IP address.

Types of RAM

DRAM (Dynamic Random Access Memory)

DRAM stands for Dynamic Random Access Memory. It is used in most of the computers. It is the least expensive kind of RAM. It requires an electric current to maintain its electrical state. The electrical charge of DRAM decreases with time that may result in loss of DATA. DRAM is recharged or refreshed again and again to maintain its data. The processor cannot access the data of DRAM when it is being refreshed. That is why it is slow.

SRAM (Static Random Access Memory)

SRAM stands for Static Random Access Memory. It can store data without any need of frequent recharging. CPU does not need to wait to access data from SRAM during processing. That is why it is faster than DRAM. It utilizes less power than DRAM. SRAM is more expensive as compared to DRAM. It is normally used to build a very fast memory known as cache memory.

MRAM (Magneto resistive Random Access Memory)

MRAM stands for Magneto resistive Random Access Memory. It stores data using magnetic charges instead of electrical charges. MRAM uses far less power than other RAM technologies so it is ideal for portable devices. It also has greater storage capacity. It has faster access time than RAM. It retains its contents when the power is removed from computer.

Different between SRAM and DRAM

SRAM

  • It is faster than DRAM.
  • It is more expensive as compared to DRAM.
  • It does not need to be power – refreshed.
  • It utilizes less power.
  • It holds data indefinitelyas long as the computer is turned on.
  • It is more complex and less compact.

DRAM

  • It is slower than SRAM.
  • It is less expensive.
  • It has to be refreshed after each read operation.
  • It utilizes more power.
  • It holds data dynamicallynot indefinitely.
  • It is less complex and more compact.

Computer Port

A port is a physical docking point using which an external device can be connected to the computer. It can also be programmatic docking point through which information flows from a program to the computer or over the Internet.

Characteristics of Ports

A port has the following characteristics −

  • External devices are connected to a computer using cables and ports.
  • Ports are slots on the motherboard into which a cable of external device is plugged in.
  • Examples of external devices attached via ports are the mouse, keyboard, monitor, microphone, speakers, etc.

Let us now discuss a few important types of ports −

Serial Port

  • Used for external modems and older computer mouse
  • Two versions: 9 pin, 25 pin model
  • Data travels at 115 kilobits per second

Parallel Port

  • Used for scanners and printers
  • Also called printer port
  • 25 pin model
  • IEEE 1284-compliant Centronics port

PS/2 Port

  • Used for old computer keyboard and mouse
  • Also called mouse port
  • Most of the old computers provide two PS/2 port, each for the mouse and keyboard
  • IEEE 1284-compliant Centronics port

Universal Serial Bus (or USB) Port

  • It can connect all kinds of external USB devices such as external hard disk, printer, scanner, mouse, keyboard, etc.
  • It was introduced in 1997.
  • Most of the computers provide two USB ports as minimum.
  • Data travels at 12 megabits per seconds.
  • USB compliant devices can get power from a USB port.

VGA Port

  • Connects monitor to a computer’s video card.
  • It has 15 holes.
  • Similar to the serial port connector. However, serial port connector has pins, VGA port has holes.

Power Connector

  • Three-pronged plug.
  • Connects to the computer’s power cable that plugs into a power bar or wall socket.

Firewire Port

  • Transfers large amount of data at very fast speed.
  • Connects camcorders and video equipment to the computer.
  • Data travels at 400 to 800 megabits per seconds.
  • Invented by Apple.
  • It has three variants: 4-Pin FireWire 400 connector, 6-Pin FireWire 400 connector, and 9-Pin FireWire 800 connector.

Modem Port

  • Connects a PC’s modem to the telephone network.

Ethernet Port

  • Connects to a network and high speed Internet.
  • Connects the network cable to a computer.
  • This port resides on an Ethernet Card.
  • Data travels at 10 megabits to 1000 megabits per seconds depending upon the network bandwidth.

Game Port

  • Connect a joystick to a PC
  • Now replaced by USB

Digital Video Interface, DVI port

  • Connects Flat panel LCD monitor to the computer’s high-end video graphic cards.
  • Very popular among video card manufacturers.

Sockets

  • Sockets connect the microphone and speakers to the sound card of the computer.

Terminals and its types

  • Dumb terminals
  • PCs acting as terminals
  • X terminals

What is SMTP?

SMTP is part of the application layer of the TCP/IP protocol. Using a process called “store and forward,” SMTP moves your email on and across networks. It works closely with something called the Mail Transfer Agent (MTA) to send your communication to the right computer and email inbox.

SMTP spells out and directs how your email moves from your computer’s MTA to an MTA on another computer, and even several computers. Using that “store and forward” feature mentioned before, the message can move in steps from your computer to its destination. At each step, Simple Mail Transfer Protocol is doing its job. Lucky for us, this all takes place behind the scenes, and we don’t need to understand or operate SMTP.

SMTP at work.

SMTP provides a set of codes that simplify the communication of email messages between email servers (the network computer that handles email coming to you and going out). It’s a kind of shorthand that allows a server to break up different parts of a message into categories the other server can understand. When you send a message out, it’s turned into strings of text that are separated by the code words (or numbers) that identify the purpose of each section.

SMTP provides those codes, and email server software is designed to understand what they mean. As each message travels towards its destination, it sometimes passes through a number of computers as well as their individual MTAs. As it does, it’s briefly stored before it moves on to the next computer in the path. Think of it as a letter going through different hands as it winds its way to the right mailbox.

Nothing fancy about it.

SMTP is able to transfer only text—it isn’t able to handle fonts, graphics, attachments, etc.—maybe that’s why it’s called simple. Fortunately, Multipurpose Internet Mail Extensions were created to lend a hand. MIME encodes all the non-text content into plain text. In that transformed format, SMTP is coaxed into transferring the data.

SMTP sometimes stands for “stop.”

Most of us don’t know this, but our Internet Service Providers typically have a limit to the number of emails we can send out over a certain amount of time. Most of the time, it’s limited to a set number per hour or per day.

Each ISP relies on its SMTP to determine (and govern) the email that can be sent out by one connection. (It is a protocol, after all.) For some people who work at home or manage large mailing lists, that could be a problem. After they hit their limit, the ISP will simply stop sending emails. If they think you’re a spammer, they might even shut down your account.

That email limit varies by ISP. For example, the typical Comcast Cable Internet customer is limited to 1,000 emails per day. (Their business customers have a limit of 24,000 emails daily.) Verizon and AT&T do it differently. They put a limit of 100 on the number of recipients you can have on one sent email.

Scheduling Criteria

There are many different criterias to check when considering the “best” scheduling algorithm :

  • CPU utilization

To make out the best use of CPU and not to waste any CPU cycle, CPU would be working most of the time(Ideally 100% of the time). Considering a real system, CPU usage should range from 40% (lightly loaded) to 90% (heavily loaded.)

  • Throughput

It is the total number of processes completed per unit time or rather say total amount of work done in a unit of time. This may range from 10/second to 1/hour depending on the specific processes.

  • Turnaround time

It is the amount of time taken to execute a particular process, i.e. The interval from time of submission of the process to the time of completion of the process(Wall clock time).

  • Waiting time

The sum of the periods spent waiting in the ready queue amount of time a process has been waiting in the ready queue to acquire get control on the CPU.

  • Load average

It is the average number of processes residing in the ready queue waiting for their turn to get into the CPU.

  • Response time

Amount of time it takes from when a request was submitted until the first response is produced. Remember, it is the time till the first response and not the completion of process execution(final response).

In general CPU utilization and Throughput are maximized and other factors are reduced for proper optimization.

Scheduling Algorithms

We’ll discuss four major scheduling algorithms here which are following :

  1. First Come First Serve(FCFS) Scheduling
  2. Shortest-Job-First(SJF) Scheduling
  3. Priority Scheduling
  4. Round Robin(RR) Scheduling
  5. Multilevel Queue Scheduling

First Come First Serve(FCFS) Scheduling

  • Jobs are executed on first come, first serve basis.
  • Easy to understand and implement.
  • Poor in performance as average wait time is high.

Shortest-Job-First(SJF) Scheduling

  • Best approach to minimize waiting time.
  • Actual time taken by the process is already known to processor.
  • Impossible to implement.

In Preemptive Shortest Job First Scheduling, jobs are put into ready queue as they arrive, but as a process with short burst time arrives, the existing process is preemptied.

Priority Scheduling

  • Priority is assigned for each process.
  • Process with highest priority is executed first and so on.
  • Processes with same priority are executed in FCFS manner.
  • Priority can be decided based on memory requirements, time requirements or any other resource requirement.

Round Robin(RR) Scheduling

  • A fixed time is allotted to each process, called quantum, for execution.
  • Once a process is executed for given time period that process is preemptied and other process executes for given time period.
  • Context switching is used to save states of preemptied processes.

Multilevel Queue Scheduling

  • Multiple queues are maintained for processes.
  • Each queue can have its own scheduling algorithms.
  • Priorities are assigned to each queue.