access stations and programming environments monday, august 17, 2001

51
Access Stations and Programming Environments Monday, August 17, 2001

Upload: blaise-greer

Post on 31-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Access Stations and Programming Environments Monday, August 17, 2001

Access Stations and Programming Environments

Monday, August 17, 2001

Page 2: Access Stations and Programming Environments Monday, August 17, 2001

Access Station Features.

• Risc based CPUs.

• Main memory of about 128 - 256 megabytes.

• Full fledged 3D supported graphics with OpenGL.

• Latest OS with user friendly GUI and software development tools.

• All systems run Unix OS supporting multi-user, multiprogramming and multitasking.

Page 3: Access Stations and Programming Environments Monday, August 17, 2001

Salient features of Unix.

• Multi-user - Support more than one user session, simultaneously, on the same system, at a time.

• Multiprogramming - Support more than one program, in memory, at a time. Amounts to multiple user processes on the system.

• Multitasking - A single process can initiate multiple threads of execution. Exploiting concurrency in a process.

• Supports virtual memory, programs larger than the physical RAM of the system, can be executed.

Page 4: Access Stations and Programming Environments Monday, August 17, 2001

Unix features continued ...

• Supports hierarchical file system to hold user data organised in the form of directories and files.

• Identifies a user with a userid and groupid and allows access permissions to resources to be specified using these ids.

• Supports a command language selectable on a per user basis. (Example: csh, sh, and ksh)

• Supports a large number of tools, libraries and utilities to aid software development.

Page 5: Access Stations and Programming Environments Monday, August 17, 2001

Architecture of Unix

KERNEL

Machine Hardware

Database Packages

Internet Tools

Compilers

UNIX Commands

Other Application System SW

shell

shell

Shell User

User

Shell

shell

Page 6: Access Stations and Programming Environments Monday, August 17, 2001

• SHELL is the Command Language Interpreter. Users interact with the system through the shell.

• APPLICATIONS are user created software and third party purchased software.

• UTILITIES are executable programs for the users to perform a variety of standard functions supplied with the system.

• To use a Unix system, the user has to perform login process.

Page 7: Access Stations and Programming Environments Monday, August 17, 2001

User Login Process.• On power-on, a Unix system boots and if

successful, displays a user login screen.

• On the login screen, the user is expected to type his/her userid and password against the respective fields and hit return on the keyboard.

• On successful login, a shell is opened in the user’s name and the filesystem access is set to the user’s home directory, the place where the user is allowed store data.

Page 8: Access Stations and Programming Environments Monday, August 17, 2001

The shell

• Unix command interpreter that acts as an interface between the user and the Unix system.

• The shell is first invoked as a user's initial process by the login process.

• The shell is governed by a set of shell and environment variables which can be declared in shell setup files.

• Setup files can also be used to define command aliases, and execute Unix commands during login and logout.

Page 9: Access Stations and Programming Environments Monday, August 17, 2001

Shells continued ...

• Commonly used shells - csh (C-shell), sh (Bourne shell), ksh (Korn shell), bash (cross between csh and sh), etc.

• Shells are associated with a shell prompt, which is a character echoed by the shell to indicate its readiness to accept the next command. Default for csh - %, sh, ksh, bash - $; is configurable.

• Each shell has it’s own set of setup files, from where it initialises the shell and environment variables.

Page 10: Access Stations and Programming Environments Monday, August 17, 2001

Shells setup files.• sh: .profile in your home directory.

• csh: .cshrc, .login and .logout in your home directory.

• ksh: .profile in your home directory and any file defined by $ENV variable.

• bash: .bash_profile, .bash_login, .profile, .bashrc and .bash_logout in your home directory.

Page 11: Access Stations and Programming Environments Monday, August 17, 2001

Setup files contents.

• Search path.

• Terminal type.

• Command aliases.

• Shell and environment variable definitions.

• Creating a custom prompt.

• Run few commands whenever you log in.

Page 12: Access Stations and Programming Environments Monday, August 17, 2001

Sample .cshrc file.stty erase ^H

set prompt="[`hostname`]${cwd}:”

alias cd 'cd \!* ; set prompt="[`hostname`]${cwd}:" '

alias cls 'clear'

alias rm 'rm -i'

set history=100; set savehist=10

set path=($path /home/pkg/pub/bin)

set TERM=vt100

setenv MANPATH {MANPATH}:/ever6/lsf4.0/mnt/man

#echo "Checking U60s status"

/sakala/sec/secjls/devlp/check-u60s.sh

Page 13: Access Stations and Programming Environments Monday, August 17, 2001

Shell & Environment variables.

• EDITOR the pathname of the default text editor.

• LOGNAME or USER the userid of the person who is currently logged in.

• HOME the pathname of login directory (used by cd and to expand ~).

• TERM the type of terminal being used.

• PATH the list of directories to be searched by the shell to find commands.

• PWD the absolute pathname of current directory.

• DISPLAY to identify the X display server.

Page 14: Access Stations and Programming Environments Monday, August 17, 2001

Basic Unix commands.

• Ownership related.

• File and directory related.

• Process related.

• File operations related.

• Commands for networked environments.

• Windowing system related.

• Miscellaneous.

Page 15: Access Stations and Programming Environments Monday, August 17, 2001

Ownership commands.• w - System uptime, who is logged in and what

they are doing.

• who - Who is logged on.

• whoami - Print current userid.

• id - Print the uid and gid of the current user.

• logname - Print the userid.

• passwd - Command for changing the password.

Page 16: Access Stations and Programming Environments Monday, August 17, 2001

File and Directory commands.

• cd - Change current directory.

• ls - List contents of the current directory.

• pwd - Print working directory.

• mkdir - Make a new directory.

• rm - Remove a file/s.

• rmdir - Remove a directory.

• file - Identify the type of file.

• wc - Gives the word count of a file.

Page 17: Access Stations and Programming Environments Monday, August 17, 2001

• chmod - Change permissions of the file or directory.

• chown - Change the ownership of the file or directory.

• chgrp - Change the group ownership of the file or directory.

Page 18: Access Stations and Programming Environments Monday, August 17, 2001

Process commands.

• ps - Print the processes status.

• kill - Kill a currently executing process.

• bg - Make an executing process run in background or batch mode.

• jobs - Show processes running in batch.

• fg - Bring back the process to foreground.

• nohup - Execute in batch without hangups.

Page 19: Access Stations and Programming Environments Monday, August 17, 2001

File Operations commands.

• head - Print the first 10 lines of a file.

• tail - Print the last 10 lines of a file.

• cat - Concatenate files.

• cp - copy files.

• mv - move files.

• find - Find files.

• diff - Compare files/directories.

• ln - Link one file name to another.

• sort - Sort files; grep - search for a pattern.

• more - Display a file one screen at a time.

Page 20: Access Stations and Programming Environments Monday, August 17, 2001

Commands for networked environments.

• telnet - Login to a host in a n/w’ed setup.

• rlogin - Remotely login to a system.

• ftp - Simple file transfer program.

• rsh - Execute a remote shell.

• rcp - Remote copy of files.

Page 21: Access Stations and Programming Environments Monday, August 17, 2001

Windowing System commands.

• set DISPLAY - Set the DISPLAY shell variable.

• xhost - Controls/maintains X host access control list.

Page 22: Access Stations and Programming Environments Monday, August 17, 2001

Miscellaneous Commands.

• umask - Set file creation permissions.

• whatis - List short man page entry for a command.

• whereis - Show where executable is located.

• which - Show the complete path of executable.

Page 23: Access Stations and Programming Environments Monday, August 17, 2001

• finger - User information lookup program.

• ping - Find network response status of a host.

• date - Print the current system date.

• cal - Calender command.

• touch - modify the access date of a file.

• clear - Clears screen.

• stty - display terminal characteristics.

• stty sane - Restores terminal characteristics to default values.

• du - Print disk usage statistics.

Page 24: Access Stations and Programming Environments Monday, August 17, 2001

Unix Online help.

• Man command: Provides reference information on topics, such as commands, subroutines, and files. The man command provides online help.

• MANPATH variable defines the search path for man pages on a system.

• Man pages information is organized under the following heads: purpose, syntax, description, flags, examples, implementation specific, Standards compliance and related information.

Page 25: Access Stations and Programming Environments Monday, August 17, 2001

Files in Unix.

• Files in Unix are entities that contain data and normally occupy disk space. Typically a file can be a directory, an executable program or simply a readable text file.

• The notion of owner in Unix has three variations: the user himself identified by userid, or a group of users identified by group id, or others.

• Access rights to a file are determined by the ownership rights. Each file will have these rights defined by way of read, write and execute permissions.

Page 26: Access Stations and Programming Environments Monday, August 17, 2001

Access Permissions• UNIX is a multi-user system. Every file and

directory in your account can be protected from or made accessible to other users by changing its access permissions. Every user has responsibility for controlling access to their files.

• Permissions for a file or directory may be any or all of: r - read

w - write

x - execute = running a program

Page 27: Access Stations and Programming Environments Monday, August 17, 2001

• Each permission (rwx) can be controlled at three levels: u - user = yourself

g - group = can be people in the same project

o - other = everyone on the system

• File access permissions are displayed using the ls -l command. The output from the ls -l command shows all permissions for all levels as three groups as -rwxrwxrwx

Page 28: Access Stations and Programming Environments Monday, August 17, 2001

Accessing the machines.

• Valid user account at SERC.– Application form duly signed by your

Advisor/Research Supervisor – Proof of studentship and payment of fees. – Valid Institute ID Card.

• Application form is normally available at SERC #104 during office hours on all working days.

Page 29: Access Stations and Programming Environments Monday, August 17, 2001

Organisation of Facility.• All PhD., Integrated PhD. and MSc. programmes

students belong to Research Pool.

• Students registered for ME, MTech and MDes programmes fall into Course Pool.

• Another pool called Common Pool where any student can use the facility.

• Every student of either pools will have two accounts - their corresponding pool account and an account for the common pool.

Page 30: Access Stations and Programming Environments Monday, August 17, 2001

Organization of Users/Machines

• Research Pool (Generally II floor) • Course Pool (Generally III floor) • Common Pool (Generally I floor)

• NIS -> Running for each pool of machines at SERC to give single sign-on feature for the user. Hence, every user at SERC will have minimum two passwords.

Page 31: Access Stations and Programming Environments Monday, August 17, 2001

• use: yppasswd command to change the password. Some machines will work with "passwd" command itself.

• use: ypwhich to know under which NIS, you are working.

• Research Pool NIS Server = ibm580_5

• Common Pool NIS server = achala

• Course Pool NIS server = manasa

Page 32: Access Stations and Programming Environments Monday, August 17, 2001

Home Directories.• /home/mas/01/userid

• /home/phd/01/userid

• /exthome/mas/01/userid

• /exthome/phd/01/userid

• /scrhome/userid

• Home directories are served out of the file servers and are governed by quota policies.

Page 33: Access Stations and Programming Environments Monday, August 17, 2001

Logon process.• Successful logon happens when the access station

can reach the NIS and File servers.• On successful logon, by default the user opens up a

CDE session. • The user logs on by opening a logon shell. This

shell is defined during the user account creation.• By default the logon shell will set the working

directory to the primary home area. The home area is where the user stores his files.

Page 34: Access Stations and Programming Environments Monday, August 17, 2001

Common Desktop Environment (CDE)

• Widely used, X-based, graphical user interface for the desktop on Unix platforms.

• Provides with tools in the form of menu items or icons to do most of the desktop tasks.

• File managing, desktop customizing tools, desktop application tools, mailers, printer managers, logon manager, etc. are few of the utilities that CDE provides.

Page 35: Access Stations and Programming Environments Monday, August 17, 2001

CDE Main Window.

• The left most icon is the analog clock showing the time.

• The second icon is the CALENDER.

• The third icon is the FILE MANAGER which will help you in handling files and directories.

• The next is PERSONAL APPLICATIONS icon.

• The fifth from left is the MAILER, used to send mails.

Page 36: Access Stations and Programming Environments Monday, August 17, 2001

• The ONE, TWO, THREE & FOUR are the different desktop environments you can choose. You can use the EXIT button to logout.

• The next icon is the PERSONAL PRINTER icon.

• The next in the row is the STYLE MANAGER, to help you custamise your working environment.

• Next is the APPLICATION MANAGER.

• This is the HELP icon.

• Last is the TRASH CAN.

Page 37: Access Stations and Programming Environments Monday, August 17, 2001

Program Development.• Use line/screen editors to enter your

program. One can use popular editor 'vi' under Unix for writing the program.

• CDE comes with it’s own Text Editor, which can be invoked by the icon under Desktop applications. This is GUI based and is proprietary to the CDE version.

• There are also publicly available text editors that are available on WWW. Vim and Emacs are the popular ones.

Page 38: Access Stations and Programming Environments Monday, August 17, 2001

Compiling & executing programs

• Once the program is entered, there are few other stages that are involved before executing the command(program).

• Compiling, and

• linking.

• Use cc command to compile a C-program.

Page 39: Access Stations and Programming Environments Monday, August 17, 2001

Linking• By default, the cc command itself calls the linker to

generate the executable.

• Otherwise, ld is the linker that is available on the Unix platforms.

• Source of information is the online man pages. Using the “man ld” brings up the man pages content to be displayed on the terminal.

• Online softcopy documentation detailing the user manuals are also available on the systems for reference.

Page 40: Access Stations and Programming Environments Monday, August 17, 2001

Debugging

• Debugging deals with the task of meticulously scanning the program code to find out places of error.

• Normally debuggers allow for syntax as well as logic corrections.

• Today’s debuggers are powerful tools since they allow to debug programs at source.

Page 41: Access Stations and Programming Environments Monday, August 17, 2001

dbx• dbx provides a powerful tool for monitoring the execution

of programs written in any language. • With dbx, you can

– suspend program execution – continue – skip sections of code – display and set the values of variables

• The dbx utility can be used to examine core files as well as executable programs. By examining a core memory image file, you can use the dbx command to examine the state of the program when it faulted.

Page 42: Access Stations and Programming Environments Monday, August 17, 2001

Time.• The time command returns the total execution time of

your program.

• The format of the output is different for the Korn shell and the C shell. The basic information is : – Real time : the total wall clock (start to finish) time your program took to

load, execute and exit. – User time : the total amount of CPU time your program took to execute. – System time : the amount of CPU time spent on operating system calls in

executing your program. – The system and user times are defined differently across different

computer architectures.

Page 43: Access Stations and Programming Environments Monday, August 17, 2001

Example ksh time output:real 0m2.58s

user 0m1.14s

sys 0m0.03s

• Explanation

0 minutes, 2.58 seconds of wall clock time.

0 minutes, 1.14 seconds of user CPU time

0 minutes, 0.03 seconds of system CPU time

Page 44: Access Stations and Programming Environments Monday, August 17, 2001

Profiling• Profiling deals with the task of finding out the time

and resource details spent on various segments of the program code.

• Any tool that reports the cumulative time spent in various parts of a program over the length of a run.

• A more restrictive definition would limit profilers to tools that obtain timing information by sampling.

• There are also tools that obtain information by embedding timing routines.

Page 45: Access Stations and Programming Environments Monday, August 17, 2001

What is Prof ? • The prof command produces an execution profile of

a program including timing statistics and count information for each routine.

• Displays for each external text symbol the % execution time spent between the address of that symbol and the address of the next.(% Time Seconds Cumsecs)

• No of times that function was called (#calls) • Average no of milliseconds per call (msec/call)

Page 46: Access Stations and Programming Environments Monday, August 17, 2001

Integrated Development Environments (IDEs).

• Unix provides with a variety of tools for program development. Each is independent of the other and the user has to know the dependencies among the tools for any fruitful use.

• IDEs solve this by providing a single window under which an environment for program development can be set and all the tools are made to work within the environment.

Page 47: Access Stations and Programming Environments Monday, August 17, 2001

IDEs.

• SoftBench on HP Unix Stations.

• TeamWare on SUN Stations.

• VisualAge on IBMs.

• DecFuse on Compaq Stations.

Page 48: Access Stations and Programming Environments Monday, August 17, 2001

Software on Access Stations.• Graphics - OpenGL libraries on all stations.

OpenInventor, Performer and Showcase on SGI systems. Data Explorer on ibmgs1 and ibmgs2.

• FEM - NISA, Algor, MSC/Aries.• Life Sciences - MSI/InsightII and Cerius.• CASE tools - Rational ROSE for Sun and HP

systems.• Numerical - Matlab, Mathematica and Maple.

Page 49: Access Stations and Programming Environments Monday, August 17, 2001

Batch Processing.• Most of the time for program development the user

will need a terminal for editing, compiling, debugging and profiling.

• The production code just needs to execute. If the process involves generation of data, then it is ideal to submit it for batch processing.

• Load Leveller on the IBMs and Load Sharing Facility (LSF) on the Suns, HPs, SGIs and Compaqs are the available software tools for batch processing.

Page 50: Access Stations and Programming Environments Monday, August 17, 2001

Dos and Don’ts• For any problem related to the facility please contact

HELPDESK of SERC at #444 or mail to [email protected]

• Eating, littering, playing games and audio files and loud discussions inside the compute bays is prohibited.

• Display locking is disallowed. Sessions will be killed without any notice.

• Submitting batch jobs other than through the batch processing tools is disallowed. Such jobs will be killed without prior notice.

Page 51: Access Stations and Programming Environments Monday, August 17, 2001

• Please donot power off or reset the systems on the floors. Call the HELPDESK.

Thank you!

Happy Computing!!