0% found this document useful (0 votes)
47 views29 pages

Introduction To Computers

This document provides an introduction to computers and programming. It discusses the different levels of transformations from problems to algorithms to programs. It also describes generations of programming languages from machine language to high-level languages. The document introduces the C programming language and operating systems, focusing on the UNIX operating system. It discusses the kernel, shell, file hierarchy, common operations, and the vi text editor in UNIX.

Uploaded by

Kishan Panpaliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views29 pages

Introduction To Computers

This document provides an introduction to computers and programming. It discusses the different levels of transformations from problems to algorithms to programs. It also describes generations of programming languages from machine language to high-level languages. The document introduces the C programming language and operating systems, focusing on the UNIX operating system. It discusses the kernel, shell, file hierarchy, common operations, and the vi text editor in UNIX.

Uploaded by

Kishan Panpaliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

INTRODUCTION TO

COMPUTERS AND
PROGRAMMING
CS F111 Computer Programming
Levels of Transformations

Problems
Algorithms
Language
Machine (ISA) Architecture
Microarchitecture
Circuits
Devices
Algorithms

▪ Step-by-step
step procedure that has
– Finiteness (guarantees to terminate)
– Definitiveness (each step precisely stated)
– Effective computability (each step could be
computed)
Programs

▪ Transform the algorithm into a


computer program using a programming
language
▪ Programming languages are mechanical
and not natural; hence are unambiguous
▪ Many programming languages for variety
of purposes
Generations of Programming
Languages
▪ Machine language
– Comprised of 0s and 1s
▪ Natural language
– Ambiguous
– Redundancy
– Complex
– Hence unsuitable for computers
▪ Programming Language
– Abstraction level between human and computer
High level languages (HLLs)

– Machine independent
– Can be compiled to run on any machine
– Much easier to write than Low level
languages
– Higher productivity and abstractions
▪ Data structures like queues, stacks etc.
▪ Control structures like loops, switch etc.
Low level languages (LLLs)
(LLLs

– Machine specific
▪ Programmer exposed to the internal machine
organization
– They access very low level details
▪ Number and type of registers
▪ Specific instructions
▪ Hardware features
– Lower productivity but higher performing
code
– Generally called as assembly language
The C Language

▪ General-purpose
purpose programming language
▪ Closely associated with the UNIX system
▪ Language is not tied with any operating
system or machine
▪ Knowing C programming helps in other
disciplines too
▪ Product in itself – can create a career
based on programming unlike other courses
Operating System

▪ An OS is a layer of software interposed


between the application program and the
hardware, and serves two primary purposes:
– To protect the hardware from misuse by runaway
applications
– To provide applications with simple and uniform
mechanisms for manipulating complicated and often
wildly different low-level
level hardware devices (such
as processor, main memory, I/O devices)
▪ Single-user single-tasking
tasking OS, single-user
multi-tasking OS, multi-user,
multi multi-tasking
OS, real time OS
The UNIX Operating System

▪ Written in high-level
level language
▪ Simple user interface that can provide the
services user wants
▪ Allows complex programs to be built from
simpler programs
▪ Hierarchical file system allowing easy
maintenance
▪ Multi-user multi-process
process system; each user
can execute several processes
▪ Hides machine architecture from the user
The UNIX System

▪ Although written in C language, the


UNIX systems support other languages
including Fortran, Basic, Pascal, Ada,
Cobol, Lisp and Prolog.
Layered architecture of Unix
Kernel
▪ It can not directly interact with
the user.
▪ But interacts with shell (or user
program) through a set of
interfaces and with hardware
devices such as processor, memory,
disk drives etc.
▪ Kernel is a program that
constitutes the central core of
the Operating System.
System
Kernel
rnel provides basic services to all other parts of t
including:
Process Management
Creation, termination, suspension, communication
Memory Management
Allocation for executing process, swapping, paging system
File Management
Allocate secondary memory for efficient storage and retrieva
access rights, reclaims unused storage
I/O Management
Provide controlled access to I/O and network devices
Scheduling processes fairly
Shell

▪ Shell is a program that provides text-


text
only interface to the user.
▪ It’s primary function is to read commands
from the console and execute them.
▪ The term Shell comes from the fact that
it is the outer most part of the OS.
▪ Shell commands
File hierarchy in Unix

▪ Unix treats everything as a file!


▪ “Everything” includes directories (or
folders) as well
▪ Root directory is represented by /
▪ All others are nested within /
Some common operations in Unix

▪ Know the current location; change it


▪ Create, delete and rename files
▪ Filters – head, tail, grep
Three special files of Unix

▪ Standard input
▪ Standard output
▪ Standard error
Redirection and Piping

▪ Input redirection (data taken from a


file other than stdin)
stdin
▪ Output redirection (data goes into a
file other than stdout)
stdout
▪ Redirecting the standard error stream
▪ Piping – from one command to another
command
vi Editor

▪ A text-based
based editor of Unix used to
write programs
▪ Works in three modes:
– Command mode
– Command line mode
– Input mode

You might also like