Way to unblock the facebook
the url will direct the facebook and open it so try it and use it to unblock the facebook and use it properly and be more friendly with your friend
Digital Divide (especially dedicated to Preetam Balla)
The term is commensurate with the term knowledge divide, both reflecting the access of various social groupings to information and knowledge, typically gender, income, race, and by location. The term global digital divide refers to differences in access between countries.
There are several definitions of the Term. Bharat Mehra defines it simply as the troubling gap between those who use computers and the Internet and those who do not.
More recently, some have used the term to refer to gaps in broadband network access.[3] The term can mean not only unequal access to computer hardware, but also inequalities between groups of people in the ability to use information technology fully. Lisa Servon argued in 2002 that the digital divide is a symptom of a larger and more complex problem -- that of persistent poverty and inequality. Mehra (2004), identifies socioeconomic status, income, educational level, and race among other factors associated with technological attainment, or the potential of the Internet to improve everyday life for those on the margins of society and to achieve greater social equity and empowerment.
More broadly, the global digital divide describes the Infotech disparities between different regions of the world in relation to generalized rates of social and technological development, (right).
One school of thought holds that, as the internet becomes progressively more sophisticated, the digital divide is growing, that those to whom it is least available are being left behind. Countries with a wide availability of Internet access can advance the economics of that country on a local and global scale. In Western society commerce, and social interaction generally, is almost entirely Internet dependant to a lesser or greater extent. Andy Grove, the former Chair of Intel, said that by the mid-2000s all companies will be Internet companies, or they won’t be companies at all.
In countries where the Internet and other technologies are less/not accessible, uneducated people and societies that are not benefiting from the information age cannot be competitive in the global economy
1.To give idea that each process has the process ID.
2.To clearify that each child process again run with its own process ID.
3.To use the functions : getpid() ( to get its process id) and getppid()
( to get the process id of its parent)
Source Code:
#include
#include
int main()
{
int pid,ppid;
pid=getpid();
ppid=getppid();
printf("The process ID is:%d\n",pid);
printf("The parent process ID is:%d\n",ppid);
return 0;
}
Output:
2.Objectives:
1.To give idea that a process can create a new sub process.
2.To clearify that a system can create a new process. (When it calls next process then the new process will have new process id).
3.To use the function : system()
Source Code:
#include
int main()
{
int val;
val=system("ls -l");
printf("Your request has been Done!\n");
return ;
}
Output:
3.Objectives:
1.To give idea that a process can create a new child process.
2.To clearify that when fork() is used it creates two versions of the program that is written inside it (So we can realize real child process using fork();)
3.To use the function : fork()
Source Code:
#include
int main()
{
printf("This is the test for fork:\n");
printf("This is to demonstrate the fork:\n");
fork();
printf("Hi! Everybody\n");
printf("My name is Mr. R.:\n");
return 0;
}
3.Objectives:
1.To give idea that a process can create a new child process.
2.To clearify that when fork() is used it creates two versions of the program
3. that is written inside it (So we can realize real child process using fork();)
4.To use the function : fork()
5.To use the functions : getpid() ( to get its process id) and getppid()
( to get the process id of its parent)
Source Code:
#include
#include
int main()
{
int pid;
printf("The main program process programm Id is:%d\n",(int)getpid());
pid=fork();
if(pid!=0)
{
printf("This is the parent process with PID:%d\n",(int)getpid());
printf("The Child PProcess ID is:%d\n",pid);
}
else
printf("This is the child process with id:%d\n",(int)getpid());
return 0;
}
Output:
#include
#include
int main()
{
int pid;
pid=fork();
if(pid==0)
{
for(;;)
printf("Child Proces\n");
}
else if(pid>0)
{
for(;;)
printf("Parent Process\n");
}
Objective: To use threads in a program
Source code:
// to print the sum up to the given number using thread.
#include
#include
#include
void * sum(void * n)
{
int sum=0;
int i;
int *no=(int*)n; // typecasting void*n into int n
for( i=0;i<=*no;i++) sum=sum+i; printf("The sum of the numbers is :%d",sum); printf("\n"); } int main() { int n; pthread_t thread1_id; printf("\nEnter the number upto which you want the sum:"); scanf("%d",&n); pthread_create(&thread1_id,NULL,&sum,&n); return 0; } Write a program for Strict Alternation for critical region problem and analyze the output. Objective: To demonstrate the strict alternation. To create new thread ,execute and wait for particular thread to finish. To use -lpthread in linking the program. Source code: #include
#include
#include
#include
void *thread1f(void * arg);
void *thread2f(void * arg);
int turn=1;
int main()
{
pthread_t thid1;
pthread_t thid2;
pthread_create(&thid1, NULL, &thread1f, NULL);
pthread_create(&thid2, NULL, &thread2f, NULL);
pthread_join(thid1, NULL);
pthread_join(thid2, NULL);
return 0;
}
void *thread1f(void * arg)
{
int a=0;
while(a++<20) { while(turn!=1) fputc('b', stderr); turn=0; } } void *thread2f(void * arg) { int b=0; while (b++<20) { while(turn!=0) fputc('a', stderr); turn=1; } } Output 3Write the problems found in strict alternation and develop new version of the program using Peterson's algorithm. Objective: To implement Peterson’s algorithm for handling race condition. To create new thread ,execute and wait for particular thread to finish. Source code: #include
#include
#include
#include
#define N 2
enum{FALSE,TRUE};
int turn=0;
int interested[N];
void leave_region(int);
void enter_region(int);
void *thread1(void *arg)
{
int i;
for(i=1;i<20000;i++) printf("Non-Critical section or first process:\n"); enter_region(0); for(i=0;i<20000;i++) printf("Critical section for First process:\n"); leave_region(0); } void *thread2(void *arg) { int i; for(i=0;i<10000;i++) printf("Non-Critical section for Second process:\n"); enter_region(1); for(i=0;i<20000;i++) printf("Critical section for second process:\n"); leave_region(1); } void enter_region(int process) { int i; int other; other=1-process; interested[process]=TRUE; turn=process; while(turn==process && interested[other]==TRUE); } void leave_region(int process) { interested[process]=FALSE; } int main() { pthread_t th1; pthread_t th2; pthread_create(&th1,NULL,&thread1,NULL); pthread_create(&th2,NULL,&thread2,NULL); pthread_join(th1,NULL); pthread_join(th2,NULL); } Output: Write the program equivalent to to ‘cp’ command of UNIX with the name ‘filecopy’ Source Code: #include
#include
#define max 100
main(int argc, char* argv[])
{
FILE *fs,*fd;
char line[max];
if (argc>3)
{
printf("Too many parameters to create a file. Use correct syntax");
exit(1);
}if (argc<3)
{
printf("Too few parameters to create a file. Use correct syntax");
exit(1);
}
else
{
if ((fs=fopen(argv[1],"r"))==NULL)
{
printf("\nCan't find the source file '%s'. \n Confirm it again.\n",argv[1]);
exit(1)
}
else
{
if((fd=fopen(argv[2],"r"))!=NULL)
{
printf("\nDestination file already exists.");
printf("\n 0 file(S) copied");
exit(1);
}
else
{
fd=fopen(argv[2],"w");
while(fgets(line,max,fs)!=NULL)
fputs(line,fd);
printf("\nOne file is copied\n");
fclose(fs);
fclose(fd);
}
}
}
return 0;
}
An Introduction to Red Hat Linux
Course Contents of Red Hat Linux –
1. File and Directory Operations
2. User Information
3. File Permissions
4. Linux File System Essentials
5. X-Window System and GUI application (introduction)
6. Standard I/O Pipes
7. String Processing
8. Process
9. VI editor
10. Bash Shell and Shell Scripting
11. Basic Network Clients
Introduction
An operating system (OS) is software designed to act as an interface between the computer and the user. It performs various important functions such as ,
• An OS is a command interpreter. It translates the high level language to machine language and vice versa.
• An OS acts as process manager. There are various processes running simultaneously in a computer. The amount of time to be spent on a process by the CPU is decided by the OS.
• An OS is a memory manager. As said above, there are various processes running simultaneously in a computer which require memory from CPU. The amount of memory to be allocated on certain process is also decided by the OS.
• An OS acts as a hardware or peripheral manager. The task of accepting input producing the output and redirecting to different peripherals is done by the OS.
About Linux
Linux is one of the popular OS in the market today. It is developed form of UNIX. So, most of its features are UNIX-like. Most of the tools found in UNIX are supported in Linux.
UNIX was designed and developed in 1960s to provide an environment to create programs. It became popular and got spread to educational institutes, research labs and industries. Later a Finnish student Linus Torvalds developed LINUX from UNIX and made the source code available on the internet. Later more developers added additional functions to LINUX.
UNIX principles
• Everything is a file including hardware.
• Configuration data are stored in the text format.
• Small-single purpose programs are present.
• It has ability to chain programs.
Linux has many unique features.
• It has a kernel programming interface. Kernel is responsible for controlling the resource and scheduling user jobs. All the programs interact with the kernel through system calls.
• Linux is a multi-user OS. This allows many users to access all the system resource almost simultaneously.
• It is a multitasking OS. It can run up to 32768 processes at a time.
• Files are arranged under a directory.
Structure of Linux system
Linux system structure consists of Kernel, Shell, Tools and Applications.
Layer view of Linux Operating System
Kernel is the heart of the Linux OS. It is loaded in the memory when computer is booted. It interacts with the hardware. It manages the system resources, allocates time for different users and process, and sets process priorities.
Shell acts as the interface between user and the computer. There are different types of Shell available in Linux. Among them, bash shell is widely used.
Linux has its own applications for word-processing, spreadsheet, creating presentation, image processing etc.
Simple Commands
Linux has six virtual consoles and one GUI console.
1. To switch between the text consoles, press
Ctrl+Alt+F1
Ctrl+Alt+F2
Ctrl+Alt+F3
Ctrl+Alt+F4
Ctrl+Alt+F5
Ctrl+Alt+F6,
To switch to GUI console, press
Ctrl+Alt+F7
2. To shut down the system, type “halt” in the command line and press enter.
3. date: To view and change current date and time.
• date (<┘): to view current system date and time. • date –s mm/dd/yy : to change date • date –s hh:mm:ss : to change time • date –s ‘mm/dd/yy hh:mm:ss’ : to change both • cal (<┘) : to view calendar of the current month and year • cal 2004 (<┘) : to view calendar of the year 2004 • cal 7 2003 (<┘) : to view calendar of July 2003 4. To pause
or
press (<┘) to scroll one line at a time. press ‘spacebar’ to scroll one page at a time. 5. To quit press q (<┘) 6. To cancel a command, press ctrl+c (<┘) 7. To clear screen clear (<┘) Getting Help • For quick help
cat –s Suppresses warning about non-existent files
cat >
cat >>
Conventions of filename
• Filename can be of maximum 255 characters.
• Special chars can be protected with quotes.
• Filename are case sensitive.
• Filenames beginning with dot is hidden file.
2. head
cp –r
4. touch
w ->write (write, edit or delete a file)
x -> execute (execute a file)
The permissions are given from the second position onwards. The first three characters indicate the permissions of the owner of the file. The next three positions indicate the permissions of the group which consist of the owner and the last three indicates the permission for others.
To change the file access permission (FAP)
The mode of the file can be changed using ‘chmod’ command.
FAP can be changed for one user or for all the users. This can be done by specifying the name of the user before +/- sign.
‘u’ indicates the owner of the file.
‘g’ indicates the group which consists of the owner.
‘o’ indicates the others.
‘a’ indicates the all.
‘+’ is used to grant permission
‘-‘ is used to revoke permission
‘=’ is used for absolute assignment
syntax:
chmod user+/-permission characters
- dir is the directory name where file is to be searched.
- There are various options available with the find command. They are as follows:
-atime +/-N List files that were accessed more or less than N days ago
-mtime +/-N List files that were accessed more or less than N days
-user username List files owned by user in username
-size N[c] List files containing N blocks or if c is specified N characters long
-type filetypechar List files whose type is filetype character
File type characters :
d for directories
b for block device file
c for character device file
l for soft link
f for regular or normal file
-name pattern List files whose name matches to the pattern
-iname pattern Same as above but case sensitive
- action can be as follows
-exec command {} \;
or
-ok command {} \;
The exec action executes the specified command on the found files.
The ok action is similar to exec. The only difference is that, it is interactive in nature.
Compression Utilities
Compression utilities are used for saving disk space by compressing large, less often used files. The compression utilities in Linux are
- gzip , gunzip (By default, extension of the compressed file will be .gz )
- bzip , bunzip (By default, extension of the compressed file will be .bz2 )
To compress file
gzip
syntax:
diff
TERM sends process the message as 'terminate yourself'
KILL forcefully free the resources using that process.
• Resuming the processes
To resume the jobs in foreground,
fg
The other method is to grant execute permission to the file and then type the file name at the prompt.
Variable
Variables can be
- shell variable
- environment variable
Shell variables are accessible within the shell only and environment variables are accessible within shell and its child shells as well.
The following commands display the list of variables
set (<┘) : Displays the list of shell variables as well as environment variables. env (<┘) : Displays the list of environment variables only. The # symbol The # symbol is used in the Shell scripts to insert comment lines. On execution, the comment line will be ignored. //**** Eg. $a=5 (<┘) It assigns the value 5 to the variable 'a'. No space in front and back of '=' is required as the space in command line is taken as an argument. 'Echo' command This command is used to display the definite value or string embedded in double quotation. Eg. $echo "Hello" (<┘) It displays the string “Hello” Eg. $a=5 $echo $a It displays the value of the variable 'a' as 5 If the user is in child shell then he cannot operate on shell variable, he has to return from child shell. To create child shell we use the command 'bash'. bash (<┘) To return from the child shell 'exit' command is used. exit (<┘) Export command To transfer the shell variable to environment variable 'export' command is used. export a (<┘) The variable 'a' is shell variable. $ps
If there is more than one bash then you are in child shell.
Eg: $a=10
$bash
$export a
$echo $a
10 is assigned to the variable 'a'. Child shell is created the shell variable is transferred to the environment variable and the value of 'a' is displayed.
$a=10
$bash
$echo $a
It doesn't displays the value of a. You need to return from child shell.
$a=10
$bash
$exit
$echo $a
$export b=6 is equvalent to $b=6
$export b
ps1 is predefined environment variable.
$echo $ps1 defines command prompt with some predefined value as [\u@\h \W]\$
where \u ->user name
\h -> Host name
\H -> Full Host name
\W -> directory
\$ -> normal user ****/
History Command
'history' command is used to display the latest commands those were used by the user. By default, it displays latest thousand commands. It is user specific command and can be viewed only after logout. The history file is saved in the directory ~/. bash_history.
( ~ is home directory of the user.path = /home/user1/. bash_history)
So, we can also read or edit the content of the file using the following command,
vi .bash_history (<┘) !! (<┘) executes last used command !x (<┘) repeats last used command started with 'x' !n (<┘) repeats a command by its number in history output !-n (<┘) repeats a command entered n commands back /************ Command line expansion Shell function; shell scripting ************/ Programming Structures Operators: 1. String operators: • –z string : Returns true, if zero length string • –n string : Returns true, if length of string is non-zero • string1 op string2 : Here op may be ‘=’ or ‘!=’ 2. Integer operators • Integer1 op Integer2 Here op may be as follows: -eq : equal to -ne : not equal to -lt : less htan -le : less or equal to -gt : greater than -ge : greater or equal to 3. File operators -e filename : Returns true if file exists -f filename : Returns true if regular (normal) file -d filename : Returns true if directory -b filename : Returns true if block device file -c filename : Returns true if character device file -r filename : Returns true if file has read permission -w filename : Returns true if file has write permission -x filename : Returns true if file has execute permission 4. Logical operator: -a : AND -o : OR Condition Syntax : test expression or [ expression ] Control Statements 1. if statement The if condition statements may be used in the following four ways. • if condition then statement fi • if condition then statement else statement fi • if condition then statement elif condition then statement elif condition then statement else statement fi • if condition then if condition then statement else statement fi else statement fi 2. Case Statements The case statement executes a shell script based on a choice. syntax: case variable in value 1) statements ;; value 2) statements ;; *) statements ;; esac 3. Loops The following sorts of loops are available for shell scripting in Linux. • for Loop It is used ot perform the same set of operations on a list of values. Syntax: for variable in list_of_values do statements done • while Loop The commands within it are executed repeatedly as long as the condition remains true. syntax: while condition do statements done • until Loop Here, the statements are executed until the condition is false. syntax: until condition do statements done Positional Parameters Linux accepts commands in the command line. A shell script can be made to accept arguments form the command line. Since the arguments represent their position, they are called positional parameters. The variables defined for the positional parameters are $# Count of arguments $* List containing arguments $0 Filename of the shell script $1 First argument $x xth argument (where 0
Example:
ping 192.168.1.X where X is a machine-id
By default, ping will continue to send and receive information until we quit with
the following command:
Ctrl+C (<┘)
traceroute Command
This command is used if there is a network to network connection.
Example:
traceroute www.redhat.com (<┘)
CCNA Guide to Cisco Networking
CCNA Guide to Cisco Networking Chapter 9 : Advanced Routing Protocols Objectives • Describe classful and classless routing protocols • Describe and configure RIPv2 • Describe and configure EIGRP
Popular posts
-
Damber Nepali Songs
Top & Famous Songs Aja Aakash Ma Euta Tara Tara Antim Palta Bhetna Aau Sabai Sathi Gaye Bigreko Manche Ma Ke Samjhi Khelyau Timro Pauju ...
-
ACKNOWLEDGEMENT and table of content of E-shopping
ACKNOWLEDGEMENT This report has been prepared for the Final Year Project on topic “E-shoppin...
-
Questions for boring minds
1) Without touching,how will you kill a Plant ? a) By Knife b) By Rope and Gun c) By Scolding d) None 2) I was in Dream. In Dream I visited ...
Featured Post
If Something Happened to You, Could Your Family Find Your Money?
Nobody likes this question, so let's get it over with quickly. If you were seriously ill or died tomorrow, would your family know whe...
Popular Posts
-
Damber Nepali Songs
Top & Famous Songs Aja Aakash Ma Euta Tara Tara Antim Palta Bhetna Aau Sabai Sathi Gaye Bigreko Manche Ma Ke Samjhi Khelyau Timro Pauju ...
-
ACKNOWLEDGEMENT and table of content of E-shopping
ACKNOWLEDGEMENT This report has been prepared for the Final Year Project on topic “E-shoppin...
-
Questions for boring minds
1) Without touching,how will you kill a Plant ? a) By Knife b) By Rope and Gun c) By Scolding d) None 2) I was in Dream. In Dream I visited ...
-
Click on the link and get the most beautiful templates to download for free
Click To download the tempalte 1
-
The main object of this lab is to be familiar with the DML(Data Manipulation Language)
DBMS LAB 4 The main object of this lab is to be familiar with the DML(Data Manipulation Language) Dele...
-
EPF, CIT and SSF: Where the Retirement Deduction on Your Payslip Goes
If you have a salaried job in Nepal, your payslip probably has a line that quietly takes a chunk of your pay before you see it. It might ...
-
Drupal JavaScripts to hide and show resources
{# 1. Main slider paragraph template #} {# File: templates/paragraph--slider-with-resources.html.twig #} <div class="slider-with-res...
-
What i have talked with my friends on 2011-04-12
Respected Sir, Things I have done on the DGC packs are: · CSV upload for the tax and city · Calculation of the total amo...
-
Festival Spending Without the Hangover: Start Saving for Next Dashain Now
Dashain is just behind us and Tihar is a couple of weeks away. If you're like most Nepali households, this is the most expensive stre...
-
DataReader Class note which is very easy
The DataReader Class The DataReader object represents a read-only, forward-only stream of data, which...