Sunday 12 February 2023

CPU & GPU Internel components with explanation

Terminology : 

VBIOSVideo basic input/output system is the BIOS of a graphics card in a computer. 
                    It initializes the graphics card at the computer's boot time.


Dynamic Kernel Module Support (DKMS) is a program/framework that enables generating Linux kernel modules whose sources generally reside outside the kernel source tree.  

CMD:  sudo dkms status   This  command will give GPU kernel & OS-kernel (C.P.U)
Ex: 
CMD:  uname -r    This  command will give OS-kernel only
Ex: 

CMD: /usr/lib/modules/6.x.x-xx-generic/kernel/drivers

This is the OS kernel path where all the drivers (input / tty / Bluetooth / GPU/ PCI ..... ) will be located

SBIOS



What is Swap memory?  and What is the purpose of Swap memory?
  • Swap space (virtual memory) is a designated area on a hard drive that is used as an extension of physical memory (RAM). 
  • When the system's RAM becomes full, inactive pages are moved to the swap space, freeing up RAM for active processes
  • While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM.
 How do we check Swap memory in our machine?

   commands to check swap memory: free -h          or     sudo swapon --show
   the output of  free -h  
                     total        used        free      shared  buff/cache   available
Mem:           125Gi       9.0Gi       113Gi       112Mi       2.8Gi       115Gi
Swap:           93Gi          0B        93Gi
  
the output of   sudo swapon --show  
        
NAME      TYPE       SIZE USED PRIO
/dev/sda3 partition 93.1G   0B   -2

Can we increase the swap memory? Ans: Yes. 

How to increase/ resize swap memory? / How to increase Swap Space in Ubuntu 22.04 LTS Jammy?

Steps to add Swap area in Ubuntu 22.04 LTS Linux

1. Check the current Swap Space

            cmdsudo swapon -s 

            result: if there is no swap memory means it will not show anything (empty)

                        otherwise shown as below

                Filename                                Type            Size            Used            Priority

                /swapfile                               file            31457276        0               -2

2. Turn off Swap

            cmd: sudo swapoff -a                             Command output shows: Nothing 

3. Create a Swap file on Ubuntu 22.04 to increase the size

   Note: While using the given command keep one thing in mind 40G means, 40GB of space you are about to allocate for Swap       

            cmd: sudo fallocate -l 40G /swapfile        Command output shows: Nothing  

4. Change file permission

            cmd:  sudo chmod 600 /swapfile              Command output shows: Nothing  

5. Mark SWAP space and activate it

            cmd:  sudo mkswap /swapfile

                    mkswap: /swapfile: warning: wiping old swap signature.

                    Setting up swapspace version 1, size = 100 GiB (107374178304 bytes)

                    no label, UUID=0764024e-ac01-4c29-91ab-bb64f7af33a3

            cmdsudo swapon /swapfile               Command output shows: Nothing 

        Note: After activating, can you check whether the Swap space is added to your system? By using the below cmd.

          cmd: sudo swapon -s     or     free -h

6. Set Ubuntu 22.04 SWAP file as permanent

            cmd:  echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

7. Set swap usage or swappiness

            cmd: sysctl vm.swappiness                  Command output shows:  vm.swappiness = 60

         However, this change is forgotten by the system after a reboot unless the following is entered in the system file /etc/sysctl.conf:

            cmdsudo nano /etc/sysctl.conf     Command will open a file, at the end of the file add vm.swappiness = 60  then save the file with the help of the options shown there. just check again if your change is saved or not?

       8. Now reload the sysctl configuration file

            cmdsudo sysctl -p

            cmdsudo reboot

for any clarification use this link: https://linux.how2shout.com/how-to-increase-swap-space-in-ubuntu-22-04-lts-jammy/#1_Check_current_Swap_Space 

How to avoid hanging issues on our laptops/Personal computers?
 1. Delete unwanted /unnecessary files and folders 📂 in laptops /PCs 💻 

    We have to delete files & folders from 3 locations

              a. Delete files & folders present in the prefetch folder

                  press windows+r  type prefetch press Enter button ==> then try to delete all files & folders  

   b. Delete files & folders present in the temp folder

                  press windows+r  type temp press Enter button ==> then try to delete all files & folders 

   c. Delete files & folders present in the %temp% folder

                  press windows+r  type %temp%  press Enter button  ==> then try to delete all files & folders  

Dockers and containers

What is docker?

Docker is an env/tool with its own OS+ user-space (related packages & modules) that resides on a bare-metal system and uses system HW/Kernel resources to serve a different purpose.


We must understand 3 environments (Bare metal,  Docker, virtualization)

·        Bare metal is one kind of environment where we test our GPUs directly

·        Docker is one kind of environment that is separated from Bare metal.

       Virtualization is software, that makes computing environments independent of physical infrastructure. In contrast, cloud computing is a service that delivers shared computing resources (software and/or data) on demand via the Internet.

·        If you launch Docker, it has its own user space with all dependent packages and its own OS.

The beauty of the docker concept :

    Docker doesn't rely on what OS is present on the machine. It's independent.

    You can run any docker, any machine. 


      Docker is controlled by a kernel space.

·        Kernel sitting very close to the hardware.                                                 

·        If Kernel space/Firmware is broken/crashed, we can’t do anything.

·        Both Bare-metal and Docker have the packages, Except Docker does not have kernel space. Docker will use kernel space which is available on the bare metal.


Ø   sudo dmesg: dmesg contains all kernel-related information (loading /unloading, module loading firmware loading. etc. lot of information).

Ø  sudo dmesg | grep -i error if you search like this it will give kernel/firmware-related error messages 

Ø  Any kernel-related error you want to see must run sudo dmesg from the home directory,

Ø  cd /var/log/ èin this folder the dmesg log file & other kernel log files are present.

èFirmware not loaded/ kernel crashed all information, You can use the command sudo dmesg | grep -i error to see the error messages.

commands related to dockers & containers

sudo docker pull <docker_name_based_on_OS> cmd will pull the specific doker into the machine

sudo docker images  ==> cmd will list the available dockers in the present machine

sudo docker rmi  -f  docker_id ==> cmd will delete a single specific docker in the present machine

sudo docker rmi  -f  docker_id_1 docker_id_2 docker_id_3 ==> Will delete multiple dockers

sudo docker ps -a ==> cmd will list the available containers in the present machine

sudo docker rm container_id ==>cmd will delete a single specific container present in the machine

sudo docker rm container_id_1 container_id_2 container_id_3 ==> will delete multiple containers

docker system prune -a   ==> It will clear space on your device by doing the following tasks 

     This command will remove: 

            - all stopped containers

            - all networks not used by at least one container

            - all images without at least one container associated with them

            - all build cache