You are on page 1of 8

Computer Hardware Clock Assignment

COMPUTER NETWORK ASSIGNMENT

COMPUTER PROGRAMMING ASSIGNMENT HELP | WWW.PROGRAMMINGASSIGNMENTSHELP.NET

Ans 1: Computer Hardware Clock


Assignment
This is a solution of Computer Hardware Clock Assignment. It is very important for a computer to
maintain the correct time, because of many-many reasons:
A computer use many software applications, and most of them are time dependent. They use
computer time to check that is it right time to perform this operation or not e.g. scheduled tasks
which gets executed at a defined time.
Many applications use parallel threading where common variables in different thread use system
time while interecting with each other, as these interaction can be performed only at right time. E.g. if
a program is performing multiplication of 4 incremented numbers in an array, then first we have to add
4 in all element, then we will multiply them, so multiplication process cannot happen before addition
of all of them, to achieve this we have to use system time.
There are some alarm application in computer, where we can set the alarm (reminder messages) for a
particular time. When sytems time reaches at that defind time, application generates a pop up
message. If the system time is wrong such pop up will arrive at wrong time.
To achieve this, all computers are equipped with a hardware IC called real time clock, powered by a
power battery (5 volt), this power souce is independent from computer main power source and this
battery provides power to this IC which helps in maintaining correct system time. Whenever there is
an issue with this battery source of real time clock (RTC IC), RTC may have wrong information of
current time.
If the user dont know what current time is, then he can fetch the time from internets universal clock
time, which is different for different location. Read about Ecommerce Website Designing Assignment.

Ans 1.1: Computer Hardware Clock Assignment


Computer hardware clock (RTC) is a clock that keeps track of the time even when the computer is
turned off. It runs on a special battery that is not connected to the normal power supply. In contrast,
clocks that are not real-time do not function when the computer is off. RTC and CPU clock are two
different entities as CPU clock is used to regulate the execution of instructions.

Ans1.2
Computers system clock or software clock runs when a computer is on. It is implemented by
computers processor. There is a fixed clock frequency of a computer, which triggers the value 0 to 1
and then 1 to 0, so that fixed number of cycles can be defined for a second, in multiple of seconds to
define minutes, and hours and so on.

Ans1.3

www.programmingassignmentshelp.net

help@programmingassignmentshelp.net

The clock that is managed by Linux kernel is not the same as the hardware clock. Hardware clock runs
even when you computer is not running. Hardware clock is also known as BIOS clock. The Linux
software clock is not always accurate. It is kept running by a periodic timer interrupt generated by PC
hardware.
The Linux kernel keeps track of time independently from the hardware clock. During the boot, Linux
sets its own clock to the same time as the hardware clock. After this, both clocks run independently.
Linux maintains its own clock because looking at the hardware is slow and complicated.
In case h/w clock needs to be update, we can do this by rebooting the computer and then setup the
clock on BIOS screen. If it is not possible, then we can use below commands to set hardware clock:
hwclock w
hwclock systohc For syncing the hardware clock with software clock.
To sync software clock to hardware clock then we can use the below commands:
hwclock -s
hwclock hwtosys for synching software clock to h/w clock
Time synchronization is required in order to make all programs work in defined manner. If there are
mismatch between clocks, then system may behave in different manner which is not as per the
defined manner e.g. execution of scheduled tasks may be either done in advance or it may get
delayed. Read about Intelligent Recommendation System.

Ans1.4
UTC is a universal time clock, which is defined once for the world. It is set on Internet, so that anyone
can access it from there. This is made to make this world work simultaneously. When a computer is
running and connected to Internet, we can issue commands to synchronize and fetch information
from UTC. This command corrects the system time make the kernel clock equivalent to UTC.

Ans1.5
Network time protocol (NTP), is a networking protocol, it is used for clock synchronization between
computers. A semi-layered and hierarchical system of time sources is used by NTP. Each level of this
hierarchy is knowns as stratum and is assigned a number starting with 0 at the top. This number
represents the distance from Reference Clock.
Only strata from 0 to 15 are valid. Stratum 16 is used to indicate that a device is unsynchronized.

ANS 2.1
www.programmingassignmentshelp.net

help@programmingassignmentshelp.net

Encrypted file-system can be easily created using cryptmount.


In this example I will demonstrate how to create an encrypted file-system on a flash drive and then
use it on another machine. You will need root privileges on machines where you want to create or
access this file-system. First we need to create the file system on the flash drive. To do this create an
entry in the /etc/cryptmount/cmtab like this
cryptusb {
dev=/media/flash/cryptusb.fs
dir=/home/adnan/cryptusb
fstype=ext3
fsoptions=defaults
cipher=aes
keyfile=/media/flash/cryptusb.key
keyformat=builtin
}
This tells cryptmount that your file-system name is cryptusb and you want to store your file-system in
/media/flash/cryptusb.fs and to mount it to /home/adnan/cryptusb. It also tells it that the filesystem
type is ext3 and to use AES algorithm to encrypt/decrypt the file-system. You can change cipher filed
to change the encryption algorithm. Its important that the keyfile and dev are flash drive paths
because other wise your file system wont reside on your flash drive and hence you wont be able to use
it on any other machine. man cmtab has more information on all the available fields and their valid
values.
Now create the file(specified in dev field) which will contain this encrypted file system and the mount
point.
# dd if=/dev/zero of=/media/flash/cryptusb.fs bs=1M count=64
64+0 records in
64+0 records out
67108864 bytes (64 MB) copied, 0.673204 s, 49.8 MB/s
# mkdir /home/adnan/cryptusb
Next generate the encryption key. You will need to specify key size in bytes
# cryptmount generate-key 32 cryptusb
generating random key; please be patient
enter new password for target manual:
confirm password:
Now issue following commands to prepare and format the file-system:
# cryptmount prepare cryptusb
enter password for target cryptusb:
# mkfs.ext3 /dev/mapper/cryptusb
# cryptmount release cryptusb

www.programmingassignmentshelp.net

help@programmingassignmentshelp.net

The file-system is now ready and can be mounted using command cryptmount cryptusb. To
unmount use cryptmount u cryptusb.

ANS 2.2
. Change path in dev and keyfile fields to path to cryptusb.fs and cryptusb.key if flash drive on this
machine is not mounted as /media/flash. You can also change dir field if you want the file system to
be mounted some where else. After adding this to /etc/cryptmount/cmtab save the file
# e2label /dev/mapper/cryptusb cryptusb

ANS2.3
She can use this file-system on another machine just copy
cryptusb {
dev=/media/flash/cryptusb.fs
dir=/home/adnan1/cryptusb
fstype=ext3
fsoptions=defaults
cipher=aes
keyfile=/media/flash/cryptusb.key
keyformat=builtin
}
to /etc/cryptmount/cmtab on other machine. Change path in dev and keyfile fields to path to
cryptusb.fs and cryptusb.key if flash drive on this machine is not mounted as /media/flash. You can
also change dir field if you want the file system to be mounted some where else. After adding this to
/etc/cryptmount/cmtab save the file and issue follwing commands
# cryptmount prepare cryptusb
# cryptmount release cryptusb
and you are done. you can now mount and unmount the file system using cryptmount. You may face
some problem accessing files and directories because of file permissions. You can always change file
and directory permissions using chmod and chown commands. A simple workaround is to make
root to be the owner of this filesystem. To do this mount this file system using cryptmount cryptusb
then issuing command chown root:root /home/adnan1/cryptusb. Then you can access this file
system as root on both machines. This way you wont have to change permissions whenever you take
this filesystem from one machine to other.

ANS3.1
Subversion is an open source version control system. Using Subversion, you can record the history of
source files and documents. It manages files and directories over time. A tree of files is placed into a
central repository. The repository is much like an ordinary file server, except that it remembers every
change ever made to files and directories.

www.programmingassignmentshelp.net

help@programmingassignmentshelp.net

To access Subversion repository using the HTTP protocol, you must install and configure a web server.
Apache2 is proven to work with Subversion. Please refer to the HTTP subsection in the Apache2
section to install and configure Apache2. To access the Subversion repository using the HTTPS
protocol, you must install and configure a digital certificate in your Apache 2 web server. Please refer
to the HTTPS subsection in the Apache2 section to install and configure the digital certificate.
To install Subversion, run the following command from a terminal prompt:
#sudo apt-get install subversion libapache2-svn

Read from our collection of Database Assignment

ANS3.2
I have created script using Skelton script, I got my Init script subversion under /etc/init.d:
#!/bin/sh
#
# start/stop subversion daemon.
EXECUTABLE=/usr/bin/svnserve
# Test exist:ence of the executable
test -f $EXECUTABLE || exit 0
# Command line options for starting the service
OPTIONS=-d -r /usr/local/svn
. /lib/lsb/init-functions
case $1 in
start)
log_daemon_msg Starting subversion daemon: $EXECUTABLE $OPTIONS
start-stop-daemon -vo -x $EXECUTABLE -S $OPTIONS
log_end_msg $?
;;
stop)
log_daemon_msg Stopping subversion daemon: $EXECUTABLE $OPTIONS
start-stop-daemon -K -qo -x $EXECUTABLE
log_end_msg $?
;;
force-reload)
$0 restart
;;
restart)
$0 stop

www.programmingassignmentshelp.net

help@programmingassignmentshelp.net

$0 start
;;
*)
log_daemon_msg Usage: /etc/init.d/svnserve {start|stop|restart}
exit 1
;;
esac
exit 0
After created that script, I have added the script to the boot sequence:
Update-rc.d svnserve defaults

ANS3.3
The Subversion repository test can be created using the following command from a terminal prompt:
# svnadmin create fs-type fsfs /usr/local/svn/repo1

ANS3.4
Once the Subversion repository is created, we can configure the access control. We need to edit the
/usr/local/svn/repo1/conf/svnserve.conf file to configure the access control. For example, to set up
authentication, we can uncomment the following lines in the configuration file:
[general]
anon-access = read
auth-access = write
password-db = passwd
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
After uncommenting the above lines, can maintain the user list in the passwd file. So, edit the file
passwd in the same directory and add the new user. The syntax is as follows:
[users]
user1 = Us3r
For Authentication on path based acl need to change in authz file
[groups]
group = user1
test=test1
[/]
@group = rw
@test = r

www.programmingassignmentshelp.net

help@programmingassignmentshelp.net

ANS 3.5
To increase security, you can pass the -r option to svnserve, which restricts it to exporting only
repositories below that path. For example:
# svnserve -d -r /usr/local/svn

ANS 3.6
Once we create the repository we can import files into the repository. To import a directory, enter the
following from a terminal prompt:
#svn import /home/user/import/project svn://hostname/repo1/project
To checkout the the project we can use the following command
#svn co svn://hostname/project project username user1
To synchronize the project repository with the local copy, you can run the update sub-command. The
syntax of the command, entered at a terminal prompt, is as follows:
#cd project; svn update

ANS3.7
The followings stpes required to get the subversion system working
After Instalation of Subversion, Intially start the svn server with coustom script under
/etc/init.d/subversion. Using the command
# /etc/init.d/subversion start
It invokes svnserver daemon.
Listen port on 3690
Then create a repo using the below command
# svnadmin create fs-type fsfs /usr/local/svn/repo1
Configure svnserver.conf for password and path based ACL auth.
Once we create the repository we can import files into the repository. To import a directory, enter the
following from a terminal prompt:
#svn import /home/user/import/project svn://hostname/repo1/project
To checkout the the project we can use the following command
#svn co svn://hostname/project project username user1
To synchronize the project repository with the local copy, you can run the update sub-command. The
syntax of the command, entered at a terminal prompt, is as follows:
#cd project; svn update

Programming Assignments Help is the best assignment help provider in the United Kingdom.
Our online assignment writing help UK is especially dedicated for the students studying in all
UK colleges and universities. Submit assignment to get the best quality assignment help.

www.programmingassignmentshelp.net

help@programmingassignmentshelp.net

You might also like