Thursday, September 5, 2024

Difference between AI, ML and DL

 Artificial Intelligence:

AI is a technology that enables systems to behave human like intelligence and sometimes more than that.

From prediction, problem solving, document writing and developing code etc to anything impossible.

Machine Learning:

Human learns from everything, but machines learns from data that generated from past. For example, machine understands the data pattern and predict the next happening. Machine is learning !!!

Deep Learning:

Similar to how Brain made up of neurons that makes the human to think and answer. Deep learning is multiple layers of a Neural networks that enables the system to think deeply and give answer.

We will see more in details each items.


 

Monday, August 12, 2024

ctags and cscope setup for Linux Kernel source code


This post explains about the details of how to setup ctags and cscope together.

For this, we will use the linux kernel source code where ctags and cscope

configured and see how easily we can navigate the source code.


Step1:

- Download the Linux kernel source tar and untar it

- Kernel source path: /home/ramesh/kernelsrc/


Step2:

Download the below content and copy into ~/.vim/plugin/cscope_maps.vim

https://cscope.sourceforge.net/cscope_maps.vim


Step3:

mkdir /home/ramesh/cscope

cd /home/ramesh/cscope

find /home/ramesh/kernelsrc/ -name "*.[chxsS]" -print > cscope.files

cscope -b -q -k


Step4: ctags:

- cd /home/ramesh/kernelsrc/

- ctags -R *


Step5: vimrc configuration

Copy the below content in ~/.vimrc file

syntax on

set hlsearch

set ruler

set tagrelative

set tags=/home/ramesh/kernelsrc

set splitright

let $CSCOPE_DB = '/home/ramesh/cscope/cscope.out'

set tabstop=4

set shiftwidth=4

set softtabstop=4

set expandtab

set backspace=indent,eol,start


Commands:

    - cscope -R

    - ctrl + ] => To jump to definition

    - gd => To jump to local variable declaration

    - gD => To jump to global variable declaration

    - ctrl + t => To jump to previous location

    - ctrl + \ + s => Search for all the occurances (in the same window)

    - ctrl + <spacebar> + s => Search for all the occurances (in the split window)

Linux Commands

 To Clear scroll back buffer in shell terminal:

    - printf '\033[3J'


Find and replace strings in sub directories:

    - find -type f -exec sed -i 's/abc/xyz/g' {} +


More commands will be updated soon







Tuesday, November 12, 2013

How to compile kernel from source rpm

Step1:
Get the kernel source rpm( like kernel-2.6.32-358.el6.src.rpm) from kernel ISO image or download it from net

Step2:
Extract the source rpm using below command

rpm2cpio kernel-2.6.32-358.el6.src.rpm | cpio -id

Step3:
Extraction of src rpm provides the linux source tar ball (like linux-2.6.32-358.el6.tar.bz2).
Untar the source using below command.

tar -xjvf linux-2.6.32-358.el6.tar.bz2

Step 4:
go to the untarred directory (cd linux-2.6.32-358.el6)
and enter make menuconfig
and select the required configuration and save it.

Step 5:
Open the Makefile and edit the string “EXTRAVERSION = " (like “EXTRAVERSION = -xyz) for custom kernel string name
Compile the kernel using below command.

make

Step 6:
Compile the kernel modules
make modules

Step7:
Install the compiled modules
make modules_install

Step8:
Install the kernel
make install

Reboot the system into custom kernel now.

Monday, June 20, 2011

C Programming Tips and Tricks – Part1:

Signed/Unsigned types:

• Use unsigned types for bit field manipulation and binary masks. For others, use signed types.
• Use casts in expression to avoid compiler interpretation to choose results.

Malloc(strlen(str)) => Wrong (because, need to add 1 byte for null termination character)
Malloc(strlen(str)+1) => Right

Switch:
In switch statement, each case should be labeled by integer-valued constants.

Static:
• For variables => it retains its value between calls; scope is limited to inside function.
• For functions => visible in only this file.

Extern:
• For variables => defined it elsewhere.
• For functions => Global scope(and is redundant)

Declarations and definitions:
Extern int i => it is the declaration (doesn’t reserve space in memory)
Int i =10 => it is the declaration and definition (Creates type and name of the object and reserve space)

Typedef:
Typedef int integer;
Unsigned integer I; // illegal

Process Address Space:

Unmapped region => For null pointer references.


Object file:
• It contains Data segment, Text segment and details of the size required for BSS segment.

Dangling pointer -> doesn’t reference anything. (Generally occurs, when returning address of a local auto variable from function, as the variable no longer exists after function exited)


Memory Issues:
Memory Corruption:
Freeing or overwriting memory that is still in use.

Memory Leak:
Not freeing memory that is not in use.


Declaration of Structures and Unions:
struct/union optional-tag
{
type1 var1;
type2 var2;
} optional_variable_definitions;

→ For Unions, all the members have an offset zero.



Wednesday, June 8, 2011

Fibre Channel Topologies

Fibre Channel Topologies:




Point-to-point:

     • Simplest Topology
     • Consists of only two fibre channel devices connected directly together.
     • Transmission medium is dedicated (Not shared)
     • Providing guaranteed bandwidth, guaranteed latency and in-order frame delivery.

Arbitrated Loop:
     • Cost effective way of connecting 127 ports in a single network without the need of fabric switch.
     • Media is shared among the devices; Limiting each device’s access.
     • When a port needs to access the loop, it must first arbitrate to access the loop. Once a port wins arbitration, it opens a loop circuit with another port. This creates a dynamic point to point connection between the two ports allowing frame transmission to begin.
     • As long as loop circuit is opened, two ports have sole use of the loop. All other ports are acting as repeaters.
     • When the two ports finish their frame transmission, loop circuit is closed and available for other ports to use.

Switched Fabric:
     • Used to connect many (2 power 24) devices in a cross point switched configuration.
     • Many devices can communicate at the same time; Media is not shared; but it is costlier.

Note: Images from Wikipedia.

Fibre Channel Node Port

Fibre Channel Node Port:

Each node has one or more node ports. Node port is a hardware function used for sending and Receiving information via the Fibre Channel Interface.

Each node port has two unique ID’s.
     1. Port_Name
     2. N_Port_ID

Port_name => Unique 64 bit identifier assigned to the port at the time of manufacturing.
                     Used for Management purposes or when port identification is required.

N_Port_ID => Unique 24 bit identifier assigned at the time of initialization of node port and its attached topology.
                   Since it is 24 bit, the maximum size of Fibre Channel Network is 2^24 ports.
                   Used for Routing the information from sending port to receiving port and also used by receiving port to examine, whether the information delivered to correct port or not.
                   N_Port_ID may change, when the configuration is changed. (Because of this, Port_name should be used for identification of port)

Port is further identified based on the topology it supports. For example, to support arbitrated loop topology, the node port should capable of performing loop specific protocols. This kind of node port is called NL_Port.

Each port has separate Transmit and Receive function.
Port Transmit Function:
Port transmit function contains an encoder that transforms binary data into the format suitable for serial transmission by embedding clock information and frequency distribution.
After encoding, information is serialized and transmitted one bit at a time.

Port Receive Function:
Port receive function receives the serial data, recovers clock information from data stream, deserialize the received data, and decodes deserialized information.