UNIVERSITY OF COLOMBO - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

UNIVERSITY OF COLOMBO

Description:

3. Review Unix Commands. Q10. ... UNIX Commands - ls. ls is used to list the files contained within a directory. ... be changed by using the chmod UNIX command. ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 30
Provided by: BIT18
Category:

less

Transcript and Presenter's Notes

Title: UNIVERSITY OF COLOMBO


1
UNIVERSITY OF COLOMBO SCHOOL OF
COMPUTING
IT2101 Computer Architecture Operating Systems
DEGREE OF BACHELOR OF INFORMATION TECHNOLOGY
2
Agenda
1. Review of RISC 2. Review Memory Access
3. Review Unix Commands
3
  • Q10. The following are four statements about
    Reduced Instruction Set Computer (RISC)
    architectures.
  • (i) The typical RISC machine instruction set is
    small, and is usually a subset of a CISC
    instruction set.
  • (ii) No arithmetic or logical instruction can
    refer to the memory directly.
  • (iii) A comparatively large number of user
    registers are available.
  • (iv) Instructions can be easily decoded through
    hard-wired control units.
  • Which of the above statements is/are true?

(a) (i) and (iii) only (b) (i), (iii) and (iv)
only (c ) (i), (ii) and (iii) only (d) (i), (ii)
and (iv) only (e) all are true.
4
  • RISC Properties in brief
  • A simple instruction set ? No complex addressing
    modes
  • Constant length instruction
  • A large register file
  • Hard wired control unit ? no need for micro
    programming

CISC process have almost opposite
characteristics of above.
5
  • Q10. The following are four statements about
    Reduced Instruction Set Computer (RISC)
    architectures.

(i) The typical RISC machine instruction set is
small, and is usually a subject of a CISC
instruction set. (ii) No arithmetic or logical
instruction can refer to the memory
directly. (iii) A comparatively large number of
user registers are available. (iv) Instructions
can be easily decoded through hard-wired control
units.
6
Which of the above statements is/are true?
(a) (i) and (iii) only (b) (i), (iii) and (iv)
only (c ) (i), (ii) and (iii) only (d) (i), (ii)
and (iv) only (e) all are true.
7
11. A Reduced Instruction Set Computer (RISC)
architecture differs from a Complex Instruction
Set Computer (CISC) architecture mainly in
relation to
  • (a) the large number of general purpose registers
    of RISC.
  • (b) all arithmetic/logic instructions which are
    register based in RISC.
  • (c) complex addressing modes which are not
    allowed in RISC.
  • (d) RISC CPUs which cannot be driven by slower
    clocks.
  • (e) typical RISC machine instructions which are
    variable in length.

8
  • Q24. In a two level memory hierarchy, the access
    time of the cache memory is 12 nano-seconds and
    the access time of the main memory is 1.5
    micro-seconds. The hit ratio is 0.98. What is
    the average access time of the two level memory
    system?
  • 13.5 nsec
  • 42 nsec
  • 756 nsec
  • 41.76 nsec
  • 30.24 nsec

9
For a two level memory system. tavg hctc
(1- hc) (tc tm) tc - Cache access time tm
- Main memory access time hc - hit ratio
tavg 0.9812 0.02(121500) 42 nsec
10
  • Q24. In a two level memory hierarchy, the access
    time of the cache memory is 12 nano-seconds and
    the access time of the main memory is 1.5
    micro-seconds. The hit ratio is 0.98. What is
    the average access time of the two level memory
    system?
  • 13.5 nsec
  • 42 nsec
  • 756 nsec
  • 41.76 nsec
  • 30.24 nsec

11
Q.25 The memory system of a certain computer
consists of a hard disk with an access time of 3
milliseconds and a main memory with an access
time of 1.5 microseconds. The hit ratio is 0.85.
What is the average access time of the memory
system?
  • (a) 0.851.5 0.153103 microseconds.
  • (b) 0.851.5 0.15(3103 1.5)microseconds.
  • (c) 0.151.5 0.85(3103 1.5) microseconds.
  • (d) 0.151.5 0.851.5 microseconds.
  • (e) 0.851.5 0.15(31.5) microseconds.

12
Average access time of the memory system tavg
hmtm (1- hm) (th tm) tm - Main memory
access time th - Hard disk access time hm
- hit ratio
tavg 0.851.5 0.15(3103 1.5)
microseconds
13
Q.25 The memory system of a certain computer
consists of a hard disk with an access time of 3
milliseconds and a main memory with an access
time of 1.5 microseconds. The hit ratio is 0.85.
What is the average access time of the memory
system?
  • (a) 0.851.5 0.153103 microseconds.
  • (b) 0.851.5 0.15(3103 1.5)microseconds.
  • (c) 0.151.5 0.85(3103 1.5) microseconds.
  • (d) 0.151.5 0.851.5 microseconds.
  • (e) 0.851.5 0.15(31.5) microseconds.

14
  • Q39. Consider the following sample directory
    listing of a UNIX file system.
  • drwxr-xr-x 2 kamal wheel 512 Jun
    27 1235 robot
  • -rw-r- - r - - 1 kamal wheel 551596 Sept
    30 set_bk2.zip
  • drwxrwxr-x 2 kamal wheel 512 Mar 20 1427
    sida
  • -rwx - - - - - - 1 kamal wheel 4287659 Jun
    27 1236 a.out
  • drwxrwxr-x 13 kamal wheel 3584 Apr
    24 2301 ssh
  • Which of the following statements is/are true?
  • All users of the system can read and modify the
    set_bk2.zip file
  • All users of the system can read but not modify
    the set_bk2.zip file
  • a.out is a program file, that can be executed by
    all users of the system
  • a.out is a program file, that can be executed by
    only its owner
  • All users under the wheel group can access and
    create a file under the ssh directory

15
UNIX Commands - ls
  • ls is used to list the files contained within a
    directory.
  • ls lists the contents of the current working
    directory.
  • For example
  • ls
  • testfile1.txt testdir1 testfile2.txt
  • shows that there are three files in the current
    working directory.
  • does not show which are files, which are
    subdirectories and which are links.
  • To get this information a long listing (ls -l) is
    required

16
UNIX ls command
  • For example
  • ls l
  • -rw-r--r-- 1 kamal staff 216 March 20
    2230 testfile1.txt
  • drwxr-xr-x 2 ajith staff 512 Jan 20 1342
    testdir1
  • -rw-r--r-- 1 kamal staff 4523 Mar 22 1720
    testfile2.txt
  • The first character in each line indicates if the
    file is a simple file or a subdirectory. A d
    indicates a subdirectory and a (dash) indicates
    a file.
  • From the above, testdir1 is a directory and the
    other two files testfile1.txt and testfile2.txt
    are simple files.

17
UNIX ls command
  • -rw-r--r-- 1 kamal staff 216 March 20
    2230 testfile1.txt
  • drwxr-xr-x 2 ajith staff 512 Jan 20 1342
    testdir1
  • -rw-r--r-- 1 kamal staff 4523 Mar 22
    1720 testfile2.txt
  • Each group of three permissions is r for read, w
    for write and x for execute. The permissions can
    be changed by using the chmod UNIX command.
  • File testfile1.txt in the above example has
    owner (kamal) permissions set to read and write
    has group (staff) permissions set to read and has
    world/others permissions set to read.

18
UNIX ls command
  • -rw-r--r-- 1 kamal staff 216 March 20
    2230 testfile1.txt
  • drwxr-xr-x 2 ajith staff 512 Jan 20 1342
    testdir1
  • -rw-r--r-- 1 kamal staff 4523 Mar 22
    1720 testfile2.txt
  • Each group of three permissions is r for read, w
    for write and x for execute. The permissions can
    be changed by using the chmod UNIX command.
  • directory testdir1 in the above example has owner
    (ajith) permissions set to read, write and
    execute has group (staff) permissions set to
    read and execute and has world/others permissions
    set to read and execute.
  • The next information given is the number of links
    to a file.

19
UNIX ls command
  • -rw-r--r-- 1 kamal staff 216 March 20
    2230 testfile1.txt
  • drwxr-xr-x 2 ajith staff 512 Jan 20 1342
    testdir1
  • -rw-r--r-- 1 kamal staff 4523 Mar 22
    1720 testfile2.txt
  • The next information given is the number of links
    to a file.
  • The following column shows the owner of the
    file, for example testfile1.txt is owned by
    kamal this is followed by the group name (staff)

20
UNIX ls command
  • -rw-r--r-- 1 kamal staff 216 March 20
    2230 testfile1.txt
  • drwxr-xr-x 2 ajith staff 512 Jan 20
    1342 testdir1
  • -rw-r--r-- 1 kamal staff 4523 Mar 22
    1720 testfile2.txt
  • The following column gives the size of the file
    in typically in blocks.
  • file testfile1.txt has 216 blocks.
  • The next column gives the data and time when the
    file was created, or the data and time when the
    file was last changed.
  • For example the file testfile1.txt was created,
    or last changed, on March 20 at 2230. The last
    column gives the name of the file.

21
UNIX ls command
  • -rw-r--r-- 1 kamal staff 216 March 20
    2230 testfile1.txt
  • drwxr-xr-x 2 ajith staff 512 Jan 20
    1342 testdir1
  • -rw-r--r-- 1 kamal staff 4523 Mar 22
    1720 testfile2.txt
  • The following column gives the size of the file
    in typically in blocks.
  • file testfile1.txt has 216 blocks.
  • The next column gives the data and time when the
    file was created, or the data and time when the
    file was last changed.
  • For example the file testfile1.txt was created,
    or last changed, on March 20 at 2230. The last
    column gives the name of the file.

22
UNIX ls command
  • ls l a.out
  • Mode links user group size d/t last
    modified file name
  • -wr-rr-- 1 joe staff 6325 Apr 18
    a.out
  • - w r - r - - r- -

- (dash) indicates a plain file. File owner
(joe) has read and write permission. Group
members (staff) and others have only read
permission
23
  • Q39. Consider the following sample directory
    listing of a UNIX file system.
  • drwxr-xr-x 2 kamal wheel 512 Jun
    27 1235 robot
  • -rw-r- - r - - 1 kamal wheel 551596 Sept 30
    set_bk2.zip
  • drwxrwxr-x 2 kamal wheel 512 Mar 20 1427
    sida
  • -rwx - - - - - - 1 kamal wheel 4287659 Jun
    27 1236 a.out
  • drwxrwxr-x 13 kamal wheel 3584 Apr
    24 2301 ssh
  • Which of the following statements is/are true?
  • All users of the system can read and modify the
    set_bk2.zip file
  • All users of the system can read but not modify
    the set_bk2.zip file
  • a.out is a program file, that can be executed by
    all users of the system
  • a.out is a program file, that can be executed by
    only its owner
  • All users under the wheel group can access and
    create a file under the ssh directory

24
  • Q41. You are given that the following set of
    UNIX commands is issued.
  • ps gt file_1
  • ls l gt file_2
  • grep secret file_2 gt file_3
  • Which of the following can be observed after the
    issue?
  • file_2 contains the current directory list and a
    list of current processes
  • Each line of file_3 if that file exists, contains
    the word secret
  • file_1 contains a list of current processes
  • file_2 contains a current directory listing
  • file_3 contains a current directory listing with
    the word secret attached.

25
UNIX ps command
  • The ps command reports information about active
    processes. If no options are specified, you will
    see information about only those processes
    connected to your current terminal session.
  • Useful options
  • ps -e
  • shows information about all processes currently
    running on the system.
  • ps -l
  • shows, among other things, the priority of your
    job, the memory size in blocks of your process,
    and the cumulative CPU time of the process.

26
UNIX grep command
  • The grep command allows you to search for a
    specified pattern in one or more files, printing
    any lines which contain the specified pattern.
  • grep has the following format
  • grep pattern file(s)
  • Useful options
  • grep -i pattern file
  • prints all lines of file that contain the
    pattern, regardless of case.
  • For example,
  • grep -i cg data
  • prints any line of data that contains "cg," "Cg,"
    "cG," or "CG." The -i option ignores the case of
    the string when searching.

27
  • Q41. You are given that the following set of
    UNIX commands is issued.
  • ps gt file_1
  • ls l gt file_2
  • grep secret file_2 gt file_3
  • Which of the following can be observed after the
    issue?
  • file_2 contains the current directory list and a
    list of current processes
  • Each line of file_3 if that file exists, contains
    the word secret
  • file_1 contains a list of current processes
  • file_2 contains a current directory listing
  • file_3 contains a current directory listing with
    the word secret attached.

28
Contact
  • External Degree Unit (EDU) of the University of
    Colombo School of Computing
  • No. 221/2A, Dharmapala Mawatha,
  • Colombo 7.
  • Phone 074-720511
  • Fax 074-720512
  • http//www.bit. lk

29
Thank you
Write a Comment
User Comments (0)
About PowerShow.com