GE6263 – COMPUTER PROGRAMMING LAB Ex.No. Date Experiment 1.UNIX COMMANDS 1.1 STUDY OF UNIX OS BASIC UNIX COMMANDS GENERAL PURPOSE COMMANDS. 1.2 COMMAND GROUPING & FILTER COMMANDS DIRECTORY HANDLING AND PROCESS MANAGEMENT COMMANDS 1.3 STUDY OF UNIX EDITOR(vi Editor) 2.SHELL PROGRAMMING SIMPLE SHELL PROGRAMS 2.1 1. Getting and displaying the academic and personal details 2. Arithmetic Operations CONDITIONAL STATEMENTS 2.2 1. 2. 3. 4. 5. Odd (or) Even Positive or Negative Biggest among three numbers Arithmetic Operations - switch case Finding the area of circle, square, rectangle and triangle TESTING AND LOOPS 2.3 1. 2. 3. 4. 5. Fibonacci Series Armstrong Number Sum of n even numbers Combinations of 1 2 3 nth power of a given number Page No. Signature
C PROGRAMMING ON UNIX DYNAMIC STORAGE ALLOCATION 3.1 Searching POINTERS 3.2 Swapping of two numbers FUNCTIONS 3.3 Finding Biggest among ‘N’ Numbers FILE HANDLING 3.4 File Management CONTENT BEYOND SYLLABUS SHELL PROGRAMMING 1 Vote Eligibility 2 Multiplication Table 3 Armstrong Number C PROGRAMMING ON UNIX 4 Addition using pointers 5 Mark aggregate 6 Allocation for two dimensional array 7 Employee Record(File concept)
Ex.NO:1.1 STUDY OF UNIX OS INTRODUCTION An operating system is software that acts as an interface between the user and the computer hardware. It is considered as the brain of the computer. It controls and co-ordinates the internal activities of the computer and provides user interface. The computer system is built with the following general components Hardware Application Software Operating System (i) Hardware: This includes the physical components such as CPU, Keyboard, Hard disk and Printer. (ii) Application Software: These are the programs that are used to accomplish specific tasks. (iii)Operating System: It is the component or the set of programs to manage and control the hardware as well as co-ordinate the applications. Each system must have at least have the hardware and the OS. Functions of an Operating System. Command interpretation: The CPU can‟t understand the commands keyed in by a user. It is the function of the OS to make it understand. Peripheral Interfaces: The OS also has to take care of the devices attached to the system. The OS oversees communication between these devices and the CPU. Memory management: The OS handles the extremely important job of allocating memory for various processes running on the system. Process management: This is required if several programs must run concurrently. CPU time would then have to be rationed out by the OS to ensure that no programs get more than its fair share of the processor time.
Services of an OS: 1. Process Management 2. File Management 3. I/O Management 4. Scheduling 5. Security Management UNIX OPERARTING SYSTEM: In the mid-1960s, AT &T Bell Laboratories developed a new OS called Multics. Multics was intended to supply large scale computing services as a utility; much like electrical power. In 1969 Ken Thompson, Dennis Ritchie and others developed and simulated an initial design for a file system that later evolved into the UNIX file system. The whole UNIX was rewritten in C. language in 1973.Today, UNIX is a giant Os and is much powerful than most of its counter parts. UNIX operating System is like a layer between the hardware and the applications that run on the computer .It has functions that run on the computer. It has functions that manage the executing applications. UNIX system is an OS, which includes the traditional system components. UNIX system includes a set of libraries and a set of applications. KERNEL is the heart of UNIX OS that manages the hardware and the executing process. The UNIX system views each device as a file called a device file. It implements security controls to protect the safety and privacy of information. The Unix System allocates resources including use of the CPU and mediates accesses to the hardware. Application portability is the ability of a single application to be executed on various types of computer hardware without being modified. This is one of the important advantages of UNIX. FEATURES OF UNIX: 1. Multitasking Multitasking is the capability of the Os to perform various tasks simultaneously. i.e. A single user can run multiple programs concurrently. 2. Multiuser Capability Multiuser capability allows several users to use the same computer to perform their tasks. Several terminals are connected to a single powerful computer and each user can work with their terminals. 3. Security Unix allows sharing of data. Every user must have a Login name and a password. So, accessing another user‟s data is impossible without permission. 4. Portability Unix is a portable because it is written in high level languages so it can run on different computers. 5. Communication Unix supports communication between different terminals connected to the Unix server and also between the users of one computer to the users of another computer located elsewhere in the network. 6. Programming Facility Unix is highly programmable, the Unix shell programming language has the conditional statements and control structures and variables. UNIX ARCHITECTURE The functioning of Unix OS is handled in 3 ways. The closest layer is the hardware, which provides the services to the OS. The Unix OS referred to Unix as the kernel, is the heart of the Unix. The other layer is the shell, which acts as the mediator that translates the commands given by the application programs. Kernel It is the core of the OS. It controls all the tasks and carries out all the functions of an OS such as memory and file management etc., and it keep track of the programs that are executing. It also handles the information exchange between the terminals such as tape drives and printers etc.,