Tuesday, May 24, 2016

Linux Kernel

Linux Kernel
Microprocessors operate on binary data; that is data composed of ones and zeros.
The processor's execution is governed by an external clock. This clock, the system clock, generates regular clock pulses to the processor and, at each clock pulse, the processor does some work. For example, a processor could execute an instruction every clock pulse. A processor's speed is described in terms of the rate of the system clock ticks. A 100 MHz processor will receive 100,000,000 clock ticks every second. It is misleading to describe the power of a CPU by its clock rate as different processors perform different amounts of work per clock tick. However, all things being equal, a faster clock speed means a more powerful processor. The instructions executed by the processor are very simple; for example ``read the contents of memory at location X into register Y''. Registers are the microprocessor's internal storage, used for storing data and performing operations on it. The operations performed may cause the processor to stop what it is doing and jump to another instruction somewhere else in memory. These tiny building blocks give the modern microprocessor almost limitless power as it can execute millions or even billions of instructions a second.
The instructions have to be fetched from memory as they are executed. Instructions may themselves reference data within memory and that data must be fetched from memory and saved there when appropriate.
The size, number and type of register within a microprocessor is entirely dependent on its type. An Intel 4086 processor has a different register set to an Alpha AXP processor; for a start, the Intel's are 32 bits wide and the Alpha AXP's are 64 bits wide. In general, though, any given processor will have a number of general purpose registers and a smaller number of dedicated registers. Most processors have the following special purpose, dedicated, registers:
Program Counter (PC)
This register contains the address of the next instruction to be executed. The contents of the PC are automatically incremented each time an instruction is fetched,
Stack Pointer (SP)
Processors have to have access to large amounts of external read/write random access memory (RAM) which facilitates temporary storage of data. The stack is a way of easily saving and restoring temporary values in external memory. Usually, processors have special instructions which allow you to push values onto the stack and to pop them off again later. The stack works on a last in first out (LIFO) basis. In other words, if you push two values, x and y, onto a stack and then pop a value off of the stack then you will get back the value of y.
Some processor's stacks grow upwards towards the top of memory whilst others grow downwards towards the bottom, or base, of memory. Some processor's support both types, for example ARM.
Processor Status (PS)
Instructions may yield results; for example ``is the content of register X greater than the content of register Y?'' will yield true or false as a result. The PS register holds this and other information about the current state of the processor. For example, most processors have at least two modes of operation, kernel (or supervisor) and user. The PS register would hold information identifying the current mode

Memory

All systems have a memory hierarchy with memory at different speeds and sizes at different points in the hierarchy. The fastest memory is known as cache memory and is what it sounds like - memory that is used to temporarily hold, or cache, contents of the main memory. This sort of memory is very fast but expensive, therefore most processors have a small amount of on-chip cache memory and more system based (on-board) cache memory. Some processors have one cache to contain both instructions and data, but others have two, one for instructions and the other for data. The Alpha AXP processor has two internal memory caches; one for data (the D-Cache) and one for instructions (the I-Cache). The external cache (or B-Cache) mixes the two together. Finally there is the main memory which relative to the external cache memory is very slow. Relative to the on-CPU cache, main memory is positively crawling.
The cache and main memories must be kept in step (coherent). In other words, if a word of main memory is held in one or more locations in cache, then the system must make sure that the contents of cache and memory are the same. The job of cache coherency is done partially by the hardware and partially by the operating system. This is also true for a number of major system tasks where the hardware and software must cooperate closely to achieve their aims.

Buses

The individual components of the system board are interconnected by multiple connection systems known as buses. The system bus is divided into three logical functions; the address bus, the data bus and the control bus. The address bus specifies the memory locations (addresses) for the data transfers. The data bus holds the data transfered. The data bus is bidirectional; it allows data to be read into the CPU and written from the CPU. The control bus contains various lines used to route timing and control signals throughout the system. Many flavours of bus exist, for example ISA and PCI buses are popular ways of connecting peripherals to the system.

Controllers and Peripherals

Peripherals are real devices, such as graphics cards or disks controlled by controller chips on the system board or on cards plugged into it. The IDE disks are controlled by the IDE controller chip and the SCSI disks by the SCSI disk controller chips and so on. These controllers are connected to the CPU and to each other by a variety of buses. Most systems built now use PCI and ISA buses to connect together the main system components. The controllers are processors like the CPU itself, they can be viewed as intelligent helpers to the CPU. The CPU is in overall control of the system.
All controllers are different, but they usually have registers which control them. Software running on the CPU must be able to read and write those controlling registers. One register might contain status describing an error. Another might be used for control purposes; changing the mode of the controller. Each controller on a bus can be individually addressed by the CPU, this is so that the software device driver can write to its registers and thus control it. The IDE ribbon is a good example, as it gives you the ability to access each drive on the bus separately. Another good example is the PCI bus which allows each device (for example a graphics card) to be accessed independently.

Address Spaces

The system bus connects the CPU with the main memory and is separate from the buses connecting the CPU with the system's hardware peripherals. Collectively the memory space that the hardware peripherals exist in is known as I/O space. I/O space may itself be further subdivided, but we will not worry too much about that for the moment. The CPU can access both the system space memory and the I/O space memory, whereas the controllers themselves can only access system memory indirectly and then only with the help of the CPU. From the point of view of the device, says the floppy disk controller, it will see only the address space that its control registers are in (ISA), and not the system memory. Typically a CPU will have separate instructions for accessing the memory and I/O space. For example, there might be an instruction that means ``read a byte from I/O address 0x3f0 into register X''. This is exactly how the CPU controls the system's hardware peripherals, by reading and writing to their registers in I/O space. Where in I/O space the common peripherals (IDE controller, serial port, floppy disk controller and so on) have their registers has been set by convention over the years as the PC architecture has developed. The I/O space address 0x3f0 just happens to be the address of one of the serial port's (COM1) control registers.
There are times when controllers need to read or write large amounts of data directly to or from system memory. For example when user data is being written to the hard disk. In this case, Direct Memory Access (DMA) controllers are used to allow hardware peripherals to directly access system memory but this access is under strict control and supervision of the CPU.

Timers


All operating systems need to know the time and so the modern PC includes a special peripheral called the Real Time Clock (RTC). This provides two things: a reliable time of day and an accurate timing interval. The RTC has its own battery so that it continues to run even when the PC is not powered on, this is how your PC always ``knows'' the correct date and time. The interval timer allows the operating system to accurately schedule essential work.

Linux Password Trick With Immutable Bit Using chattr Command

                                                            Linux Cheat Sheat
Linux Password Trick With Immutable Bit Using chattr Command
What is an immutable attribute on a Linux?
A file with an immutable attribute cannot be:
Modified
Deleted
Renamed
No soft or hard link created by anyone including root user.
Only the root (superuser) or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute. Use the lsattr command to list file attributes on a Linux second extended file system that you set with the chattr command.
How to make a Linux File unchangeable ( unalterable ) so that no one can modify it
First, you need to login as root user. Only root user can set and remove immutable flag on a file. The syntax is:
chattr +i file
chattr +i /path/to/filename
Type the following command to write protect /etc/shadow file on a Linux: chattr +i /etc/shadow
Now, login as the normal user (say vivek) and type the passwd command to change password:
$ passwd
Changing password for user vivek.
Changing password for vivek
(current) UNIX password: OLDPASSWED
New password: NEWPASSWD
Retype new password: NEWPASSWD
passwd: all authentication tokens updated successfully.
Logout and try to login with the new password. However, system will not accept your new password. You still need to use the old password.
To get the list of Linux second extended file system using the lsatter command (run as the root user ):
# lsattr /etc/shadow
----i-------- /etc/shadow
Please note that even root user is not allowed to change the password. You can remove the attribute using the following command (again must be run as the root user):
chattr -i /etc/shadow
lsattr /etc/shadow
Sample outputs:
------------- /etc/shadow
  • Securing mount points on a Linux
Want to write protect the entire mount point so that no one can add or delete files including root user? Try:
# secure partition mounted at /securebackup location ##
chattr +i -R /securebackup
lsattr -d /securebackup
lsattr -l /securebackup
cd /securebackup
## Try to add or delete something ##
echo "test" > foo.txt
mkdir foo
ls -l
rm SeaToolsDOS223ALL.ISO
## Remove it again ##
cd /
chattr -i -R /securebackup
lsattr -d /securebackup

The -R  option recursively change attributes of directories and their contents. This is useful to protect web server DocumentRoot or other publicly accessible directory over sftp/ftp.

Integrate social media with access network to promote business


Integrate social media with access network to promote business
 Social networking platform rendering incredible features to all its users like sharing their views with one another and much more. It is not just a platform for sharing your ideas and thoughts but it is much more as it can be used as a platform for managing business activities. Blending the privileges of social media and free guest data access to largely increase efficiency, customer experience, and brand awareness, the social media has introduced this new social media integration with access network.

Integrate social media with access network - Best way to Enhance your Business

 Social media integration with access network router, provoking customers seeking for data to check in and like your social media page before utilizing the web for free. This unlocks the entrance to developing friendly relationships with your customers by sharing offers and announcements, building engagement on your social network page, and obtaining complete insights about your customer base.You might be wondering how this helps the users of the social media. One of the best highlights of this free data access is that with just two mouse clicks, you can create a splash page that allows users check-in to your business page in exchange for free data access, instantly providing access to your current news and deals. You can do a lot more using this integration.
  
Free data access provided by operator
 ·         You can offer exclusive deals to your trustworthy customers.
·         You can also learn more about the customers connecting to your network to generate a better user experience and promote engagement.
·         The customers can check in to your business’ social media page so that they can gain access to the internet.
·         Social media integration is a one less password to remember, one less hassle for your customers, and the obvious way to create a lasting connection.
·         It doesn’t require any expensive third-party services or Wi-Fi passwords.
·         All your customers need to do is just check in to your social media page on their laptop, tablet or smartphone and they can begin browsing the web. It’s a perfect data access solution for most businesses like restaurants, retailers, hotels, convention halls, and any other business wherein people may wish to surf the web during their visit.

Benefits of Social media integration

·         For business owners, this is an amazingly comfortable and hassle-free means to provide your customers free data access.
·         It enhances the visibility and activity of your social media page. As there would be more check-ins and engagement, it eventually boosts activity on your page which in turn increases your page ranks.
·         Extra check-ins can also drive to a new business. When people check-in to your social media page, it sends an automatic notification to their friends which includes your business name and address. This means that you are approaching new potential customers via the best possible avenue.
·         Consequently, these people will also be able to like and engage with your social media page before proceeding to browse the internet.