Definition Of Inter-Process Communication
In computing programs, we need some medium of communication that will facilitate communication between the different processes. Processes can make use of the kernel of the operating system in order to communicate between the different processes all of whom share a unique space in the memory.
Different Mechanisms Of Communication
A number of different mechanisms can be used for the function of communication between processes. Different application programs may require different modes of communication. There are a few basic mechanisms that Unix-based operating systems like Linux use to allow message exchange between different processes. These are as follows:
In computing programs, we need some medium of communication that will facilitate communication between the different processes. Processes can make use of the kernel of the operating system in order to communicate between the different processes all of whom share a unique space in the memory.
Different Mechanisms Of Communication
A number of different mechanisms can be used for the function of communication between processes. Different application programs may require different modes of communication. There are a few basic mechanisms that Unix-based operating systems like Linux use to allow message exchange between different processes. These are as follows:
·
Pipes
·
Semaphores
·
Shared Memory
·
Message Queues
Pipes:Pipes are communication devices through which
messages flow in only a single direction. A couple of file descriptors is
present in a pipe that indicate at a pipe inode and then the file descriptors
are returned via the filedes. In case of the file descriptor pair, filedes[0]
is used for reading whereas filedes[1] is used for writing.
In pipes, data once
read from the read descriptor cannot be read once more. Another feature of the
pipe is that if data is written continuously into the write descriptor, these
data will be readable only in the order in which these data was
written.
When a pipe system
call is invoked a pair of file descriptors is created. A pipe is implemented
within the file system by the kernel. When the pipe system call is made, the
kernel allocates free inodes and creates a pair of file descriptors and also
the corresponding entries in the file table which the kernel makes use of. The
kernel ensures that the two descriptors are for reading and writing.
FIFOs: FIFOs(First In, First Out) are much likes pipes in
their operations. FIFOs have an access point, which is actually a file within a
file system. Unlike pipes which last for only the life-cycle in which they are
created, FIFOs last throughout the life-cycle of the
system.
Semaphores: Semaphores used in process communication are
user mode versions of kernel semaphores. They operate as standard blocking
devices and can be used to monitor the availability of system resources like
the shared memory segments.
Shared Memory: Shared memory is a System V IPC mechanism that
allows message
exchange between processes if they share
the virtual address space. Any process sharing the memory can read or write to
it.
Message Queues: Message queues allow different processes to
communicate with each other by exchanging messages or short blocks of data.
Sockets: Sockets allow
different computers connected to a network exchange data through the network.
They can also be used to communicate between processes within the same
computing system.
MORE EXPLANATION
PIPE
A pipe is a way to connect the output of
one program to the input of another program without any temporary file.
Pipe Defined as:
"A pipe is nothing but a temporary storage
place where the output of one command is stored and then passed as the input
for second command. Pipes are used to run more than two commands ( Multiple
commands) from same command line."
Syntax:
command1 | command2
command1 | command2
semaphore
In programming, especially in Unix systems, semaphores are a technique for
coordinating or synchronizing activities in which multiple processes compete for the same operating system resources. A semaphore is a
value in a designated place in operating system (or kernel) storage that each process can check and then change. Depending on the
value that is found, the process can use the resource or will find that it is
already in use and must wait for some period before trying again. Semaphores
can be binary (0 or 1) or can have additional values
.
What is Shared Memory?
Shared
memory (SHM) is another method of interprocess communication (IPC) whereby 2 or
more processes share a single chunk of memory to communicate.
Message Queues:
The
basic idea of a message queue is a simple one.
Two
(or more) processes can exchange information via access to a common system
message queue. Process must share a common key in order to gain access to the queue in the first place
(subject to other permissions.
Encryption &
Decryption in Linux
ccrypt is a utility for encrypting and decrypting files and
streams. It was designed as a replacement for the standard unix crypt utility,
which is notorious for using a very weak encryption algorithm. ccrypt is
based on the Rijndael cipher, which is the U.S. government's chosen candidate
for the Advanced Encryption Standard (AES, see http://www.nist.gov/aes). This cipher is believed to provide very strong security.
Unlike unix crypt, the algorithm
provided by ccrypt is not symmetric, i.e., one must specify whether to
encrypt or decrypt. The most common way to invoke ccrypt is via the
commands ccencrypt and ccdecrypt. There is also a ccat
command for decrypting a file directly to the terminal, thus reducing the
likelihood of leaving temporary plaintext files around. In addition, there is a
compatibility mode for decrypting legacy unix crypt files. An emacs mode is
also supplied for editing encrypted text files.
Encryption and decryption depends on
a keyword (or key phrase) supplied by the user. By default, the user is
prompted to enter a keyword from the terminal. Keywords can consist of any
number of characters, and all characters are significant (although ccrypt
internally hashes the key to 256 bits). Longer keywords provide better security
than short ones, since they are less likely to be discovered by exhaustive
search.
MODES
ccrypt can operate in five different modes. If more than one mode is specified, the last one specified takes precedence. The aliases ccencrypt, ccdecrypt, and ccat are provided as a convenience; they are equivalent to ccrypt -e, ccrypt -d, and ccrypt -c, respectively.
-e, --encrypt
Encrypt. This is the default mode.
If filename arguments are given, encrypt the files and append the suffix .cpt
to their names. Otherwise, run as a filter.
-d, --decrypt
Decrypt. If filename arguments are
given, decrypt the files and strip the suffix .cpt from the filenames,
if present. Otherwise, run as a filter.
Encrypting the
file (password.txt)
To see the
contents of Encrypted file
To find any
particulat text use GREP command
To decrypt the
file
0 comments:
Post a Comment