Operating Systems Important Definitions

Operating Systems Important Definitions

Single contiguous allocation:  Simplest allocation method used by MS-DOS.  
                All memory (except some reserved for OS) is available to 
                a process.

Partitioned allocation: Memory is divided in different blocks

Paged memory management: Memory is divided in fixed sized units called 
                page frames, used in virtual memory environment.

Segmented memory management: Memory is divided in different segments (a 
                segment is logical grouping of process' data or code)
                In this management, allocated memory does'nt  have to 
                be contiguous.

Most of the operating systems (for example Windows and Linux) use Segmentation with Paging.
A process is divided in segments and individual segments have pages.
Paging is a memory management scheme that eliminates the need for contiguous allocation of physical memory. This scheme permits the physical address space of a process to be non – contiguous.


Virtual Memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.


The mapping from virtual to physical address is done by the memory management unit (MMU) which is a hardware device and this mapping is known as paging technique.

The Physical Address Space is conceptually divided into a number of fixed-size blocks, called frames.

The Logical address Space is also splitted into fixed-size blocks, called pages.

A Memory Management technique in which memory is divided into variable sized chunks which can be allocated to processes. Each chunk is called a Segment. A table stores the information about all such segments and is called Segment Table.

Page Fault  A page fault is a type of interrupt, raised by the hardware when a running program accesses a memory page that is mapped into the virtual address space, but not loaded in physical memory.



Raspberry Pi Handy Notes

Raspberry Pi Handy Notes



########################################################################

                                Raspberry Pi Pre-requisites

########################################################################


sudo mount -o remount,rw /media/boot

Note: This will give access to the "boot" partition of raspberry pi's SD card. 

How to flash raspberry pi image into SD card from ubuntu OS Terminal's  command line? 
 
1. First get the device in /dev corresponding to SD inserted into the laptop.
$ sudo fdisk -l | grep "/dev/sd"

Disk /dev/sda: 29.74 GiB, 31914983424 bytes, 62333952 sectors
/dev/sda1        2048 62333951 62331904 29.7G  b W95 FAT32
 
 2. Now, use dd command to copy the image into the SD card.
# sudo dd bs=1M if=/home/<user>/raspberry_pi.img of=/dev/sda1 status=progress conv=fsync

2891972608 bytes (2.9 GB, 2.7 GiB) copied, 95 s, 30.4 MB/s
 
 
How to change the metric of ethernet port so that routing over Wi-Fi to internet is preferred over ethernet port

1. install 'ifmetric' in linux machine
#sudo apt-get install ifmetric

2. Do "route -n"

3.  ifmetric eth0 <any number greater than me>

once set, this will persist after reboot.

4. do "route -n" and check whether 'ethernet interface' metric is greater than 'wlan interface metric'.

To change the resolution of Raspberry pi, 

run the command sudo raspi-config, navigate to Advanced Options > Resolution, and choose an option.

Add route in linux to the default gateway so that the port is reachable externally

route add default gw 10.10.1.1 eth0


Steps to ensure that Wi-Fi scan connects to pre-defined SSID in RASPBERRY pi


1. In /etc/dhcpcd.conf   (at this place we can assign static ip address to raspberry pi)
#interface wlan0
#static ip_address=192.168.1.201/24
#static routers=192.168.1.1

#static domain_name_servers=192.168.1.1

2. In the below file add the changes

Neelkanth $:cat /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)


# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

3.  Now add the ssid and password to the below file. On reboot, Raspberry pi will automatically connect to this.
Neelkanth $:cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=IN

network={
ssid="sparrow"
psk="whyshoulditell"
key_mgmt=WPA-PSK
}

How to use minicom alternative in Raspberry pi as computer to which a device's serial console is connected to Raspberry pi via USB  ?
# apt-get install picocom
# picocom /dev/ttyUSB0 -b 115200 -l
(Exit picocom: Ctrl+a, then Ctrl+x)


Do this to ensure that the keyboard settings are changed to US format.


sudo vi /etc/default/keyboard 


XKBLAYOUT=”gb”

Change the gb to us 
(This assumes you want a us mapping, if not replace the gb with the two letter code for your country)



##############################################################
Install "terminator" terminal software in raspberry pi.
##############################################################
sudo apt-get install terminator


############################################################
                               Install webcam in raspberry pi
############################################################
sudo apt-get install fswebcam

############################################################
                               Install text editors:
############################################################
install vi editor and gedit

make changes in vimrc.

To be added to vimrc
set cindent
set expandtab
set shiftwidth=4
set tabstop=4
set hlsearch


############################################################
Live video feed using raspberry pi camera or normal USB webcam. 
Complete working steps:

Note: With this approach, there is 5 secs delay in video reception.
############################################################
1. sudo apt-get update
2. sudo apt-get upgrade
3. sudo apt-get install motion -y    [install motion capture software]
4. ls /dev/video*       [check if any video device is created]

5. sudo modprobe bcm2835-v4l2        
[if cam is raspi camera, use this. this has to be done in 
  .bashrc or startup scripts   ---> write into this ==> /etc/rc.local]

6. v4l2-ctl -V                       [check camera details]  
7. sudo vi /etc/motion/motion.conf   [do the following]
    a. daemon on
    b. stream_localhost off
    c. target_dir /home/pi/Monitor
    d. v4l2_palette 15
    e. width 640 
    f. height 480 
    g. framerate 10 
8. sudo vi /etc/default/motion
    start_motion_daemon=yes

9. mkdir /home/pi/Monitor
   sudo chgrp motion /home/pi/Monitor
   chmod g+rwx /home/pi/Monitor

10. sudo service motion start       [do this in /etc/rc.local]

############################################################
Steps to install apache 2 server in Raspberry Pi and access camera 
connected to Rapsberry pi remotely via WebUI/Browser
############################################################
sudo apt-get install apache2 -y

This will also create a new directory in /var/ called /www/ which we shall use to serve our pages.

Open the text editor on your Raspberry Pi. We will now write a few lines of HTML to build a simple web page.

src="http://192.168.0.3:8081/">
script>


To make sure the IP address matches that of your Pi we add :8081 at the end. 
We then instruct the browser to load a JavaScript file containing the strapdown 
functionality. Save your file as index.html to your home directory. 
Open a terminal and type the following to copy the file to our web server:

$ sudo cp /home/pi/index.html /var/www/html/


Finally, we need to start our web server and restart the motion service.


$ sudo service apache2 start

$ sudo service motion restart

pi@raspberrypi:~ $ sudo cp ~/Desktop/index.html /var/www/html/
pi@raspberrypi:~ $ sudo service apache2 restart

#######################################################################
Steps to Connect Raspberry Pi to internet via Wi-Fi interface. At the same time, 
connect PI to local network for ssh. And wifi shouldn't get disconnected.
#######################################################################
1.  raspi-config t  [enable ssh and configure password]
2.  delete default route to the gateway device connected to raspberry Pi ethernet port.

pi@raspberrypi:~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    202    0        0 eth0   <------------
0.0.0.0         192.168.1.1     0.0.0.0         UG    303    0        0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 wlan0

pi@raspberrypi:~ $ route del default gw 192.168.0.1   <-------------------------------
[Procedure incomplete.. to be updated later]


##################################################################
To open a video from terminal
##################################################################
First install vlc player by running the below commands on terminal
sudo add-apt-repository ppa:videolan/stable-daily
sudo apt-get update
sudo apt-get install vlc

Then go into the directory which contains videos you want to play,
cd /path/to/the/directory/which/contains/videos

Play the video from terminal using vlc player,
vlc "videofilename.fileformat"

##################################################################
Install shotwell to open a picture via terminal,
##################################################################
sudo add-apt-repository ppa:yorba/ppa
sudo apt-get update
sudo apt-get install shotwell

Then go into the directory which contain picture you want to open,
cd /path/to/the/directory/which/contains/picture

Open the picture via terminal using shotwell,
shotwell "picturefilename.fileformat"


############################################################
Install Tinker in python   [Develop GUI using python]
############################################################
Finally, Install Tkinter
sudo apt-get install python-tk

for python 3
sudo apt-get install python3-tk

Tutorial to learn Tinker:
https://www.python-course.eu/tkinter_labels.php


######################################################
gpio bulb on/off testing: 
######################################################
echo "17" > /sys/class/gpio/export 
echo "out" > /sys/class/gpio/gpio17/direction
echo 1 > /sys/class/gpio/gpio2/value
echo 0 > /sys/class/gpio/gpio2/value

###############################################################################

Install Driver for HDMI
###############################################################################

Open terminal and Download the driver on RPI

Run:

git clone https://github.com/Elecrow-keen/Elecrow-LCD35.git


Install driver
=====================================================================
Run:
cd Elecrow-LCD35
sudo ./Elecrow-LCD35


Switch to HDMI:

Run:
cd Elecrow-LCD35
sudo ./Elecrow-LCD35 hdmi


Transmit Live Video Feed from Raspberry Pi camera to vlc media player in same network:

Give the below command in Raspberry Pi linux terminal:

raspivid -o - -t 0 -n -w 600 -h 400 -fps 12 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264


give the below in vlc media player in laptop or some other device

rtsp://192.168.1.6:8554/

i.e. rtsp://<ip address of raspberry pi>:8554/



#########################################################
How to configure static ip address in raspberry pi
#########################################################
in file /etc/dhcpcd.conf,

paste the below:

interface wlan0
static ip_address=192.168.1.200/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

and reboot.....
after this, the ip address assigned would be static.

############################################################

How to view current username in linux terminal
############################################################
whoami

###########################################################

Disable vim automatic visual mode on mouse select
###########################################################
copy vimrc contents from /etc/vimrc to ~/.vimrc

set mouse-=a

add to ~/.vimrc: set mouse-=a 


######################################################

Steps to run Python Program after Raspberry pi boots
up:
Add the ones that are highlighted in yellow
######################################################
Neelkanth $:cat ~/.config/lxsession/LXDE-pi/autostart 
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@midori
@python /home/pi/python_gui_automate_remote_camera.py

########################################################

Python program using pyautogui library to start
raspberry pi camera so that it can be accessed by
vlc player application running on any device in the
network
########################################################
@python /home/pi/python_gui_automate_remote_camera.py
Neelkanth $:cat python_gui_automate_remote_camera.py 
import pyautogui
import time

time.sleep(15)

###############################################################
# open Terminal window
###############################################################
pyautogui.PAUSE=1
pyautogui.click(x=142, y=19, clicks=1, interval=1, button='left')
################################################################
# Now, double left click on terminal tab so that i would auto
# adjuct PI 3.5 Touch Screen.
################################################################
pyautogui.PAUSE=1
pyautogui.click(x=476, y=54, clicks = 1, interval = 1, button='left')

#################################################################
# Now, put the mouse pointer onto the screen and start typing
#################################################################
pyautogui.PAUSE=1
pyautogui.click(x=52, y=149, clicks = 2, interval = 2)

##################################################################
# Now, start typing on the terminal
##################################################################
pyautogui.typewrite("raspivid -o - -t 0 -n -w 640 -h 480 -fps 12 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264\n", interval=0.1)


########################################################################
How to enable monitor mode in ubuntu, such that the wifi processes don't change the 
WLAN interface back to Monitor Mode:

Note: airmon-ng ensures that all the processes responsible for starting WLAN interface in 
managed mode are killed. 
########################################################################
vvdn@11684--SW--C:~$ cat monitor_mode.py 
import os

os.system("sudo airmon-ng start wlp9s0")

Output:
sudo python3 monitor_mode.py 

Found 4 processes that could cause trouble.
Kill them using 'airmon-ng check kill' before putting
the card in monitor mode, they will interfere by changing channels
and sometimes putting the interface back in managed mode

    PID Name
    991 avahi-daemon
    998 NetworkManager
   1033 wpa_supplicant
   1037 avahi-daemon

PHY Interface Driver Chipset

phy0 wlp9s0 iwlwifi Intel Corporation Wi-Fi 6 AX200 (rev 1a)

(mac80211 monitor mode vif enabled for [phy0]wlp9s0 on [phy0]wlp9s0mon)
(mac80211 station mode vif disabled for [phy0]wlp9s0)


#####################################################################
Code to configure ip address on ethernel port on laptop running Ubuntu and
this is the interface which is connected to the ethernet interface of Raspberry pi:
#####################################################################
import os
import time

os.system('sudo ifmetric enp0s31f6 1000')
os.system('sudo ifconfig enp0s31f6 down')
os.system('sudo ifconfig enp0s31f6 up')
os.system('sudo ifconfig enp0s31f6 10.10.10.2/24 up')
os.system('sudo route add default gw 10.10.10.2 enp0s31f6')

time.sleep(2)
os.system('sudo ifmetric enp0s31f6 1000')


Speech to Text and Text to speech in Raspberry pi

Speech to Text and Text to speech in Raspberry pi 

Note: The below has been Tested in Raspberry Pi 3 version B+ board.

pre-requisites:
usb sound card, mic, speaker

1. 

Check if the USB sound card is getting detected in raspberry pi
pi@raspberrypi:/dev $ lsusb
Bus 001 Device 009: ID 8086:0808 Intel Corp. 


Below is the location where alsa.conf will be present in new systems
pi@raspberrypi:/dev $ cd /usr/share/alsa

pi@raspberrypi:/usr/share/alsa $ ls
alsa.conf  alsa.conf.d  cards  init  
pcm  smixer.conf  sndo-mixer.alisp  speaker-test  topology  ucm  utils.sh:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear


copy the below into  /etc/modprobe.d/alsa-base.conf

# Load USB audio before the internal soundcard
options snd_usb_audio index=0
options snd_usb_audio index=1
options snd_bcm2835 index=2
# Make sure the sound cards are ordered the correct way in ALSA
options snd slots=snd_usb_audio,snd_usb_audio,snd_bcm2835

command to check the list of installed sound cards in Raspberry Pi
pi@raspberrypi:~/demo_python_codes $ 
cat /proc/asound/cards 
 0 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA
                      bcm2835 ALSA
 1 [Device         ]: USB-Audio - USB PnP Sound Device
                      C-Media Electronics Inc. USB PnP Sound Device at usb-3f980000.usb-1.4, full spe

pi@raspberrypi:~ $ cat /proc/asound/modules 
$ cat /proc/asound/modules 
 0 snd_bcm2835
 1 snd_usb_audio

 0 snd_bcm2835             <-------------------- default sound card
 1 snd_usb_audio           <-------------------- usb audio card 


2. In terminal, give the below command 
#alsamixer
increase volume for mike and speaker

Testing microphone
Next, we need to set the mic recording volume to high. 
To do this, enter the command "alsamixer" in the terminal.
 On the graphical interface that shows up, press the up/down 
arrow keys to set the volume. Press F6 (all), then select the 
webcam or mic from the list. Again, use the up arrow key to 
set the recording volume to high.

Use "audacity" for testing microphone and speaker coonected to USB sound card
sudo apt-get install audacity


3.
Speech Recognition in python

install the following packages [raspberry pi comes with python 2.7 and 3.5]
sudo pip --no-cache-dir install SpeechRecognition 
sudo apt-get install python-pyaudio python3-pyaudio
sudo python -m pip install --upgrade --force setuptools
sudo python -m pip install --upgrade --force pip

Command to view sound cards connected to RASPBERRY PI.
pi@raspberrypi:~ $ cat /proc/asound/cards

 0 [Device         ]: USB-Audio - USB PnP Sound Device
                      C-Media Electronics Inc. USB PnP Sound Device at usb-3f980000.usb-1.5, full spe
 1 [U0x46d0x825    ]: USB-Audio - USB Device 0x46d:0x825
                      USB Device 0x46d:0x825 at usb-3f980000.usb-1.3, high speed
 2 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA
                      bcm2835 ALSA

A FLAC encoder is required to encode the audio data to send to the API
sudo apt-get install flac


Run the below python code to convert speech to text. If the code return an error, 
check the 'mic' device name that gets printed by the code on the terminal.
for e.g. 
mic_name = "USB PnP Sound Device: Audio (hw:0,0)"

Neelkanth $:cat basic_STT_and_TTS_testing_with_dictionary.py 
########################################################################
#        Mission Speech Recognition [Lakshya: Personal Assistant]
########################################################################

#########################################################################
#        Include Python Libraries
#########################################################################
import speech_recognition as sr
import os

#########################################################################
#             INITIALIZING SPEECH RECOGNITION ENGINE
#########################################################################

#enter the name of usb microphone that you found using lsusb
mic_name = "USB PnP Sound Device: Audio (hw:0,0)"
#Sample rate is how often values are recorded
sample_rate = 48000
#Chunk is like a buffer. It stores 2048 samples (bytes of data)
#here. 
#it is advisable to use powers of 2 such as 1024 or 2048
chunk_size = 2048
#Initialize the recognizer
r = sr.Recognizer()
############################################################################
#            INITIALIZING MIC
############################################################################

#generate a list of all audio cards/microphones
mic_list = sr.Microphone.list_microphone_names()
print "#####################################################################"
print "The below are the list of mic's available for Raspberry pi"
print mic_list
print "#####################################################################"

############################################################################
#    The following loop aims to set the device ID of the mic that
#    we specifically want to use to avoid ambiguity.
############################################################################
for i, microphone_name in enumerate(mic_list):
    if microphone_name == mic_name:
       device_id = i
########################   END OF ALL INITIALIZATIONS ######################


############################################################################
# Actual Program starts here... Infinite while loop
############################################################################

while True:
      #####################################################################
      # Use the microphone as source for input. Here, we also specify 
      # which device ID to specifically look for, incase the microphone 
      # is not working, an error will pop up saying "device_id undefined"
      #####################################################################
   with sr.Microphone(device_index = device_id, sample_rate = sample_rate, 
chunk_size = chunk_size) as source:
        ###################################################################
# Wait for a second to let the recognizer adjust the 
# energy threshold based on the surrounding noise level
        ###################################################################
r.adjust_for_ambient_noise(source)


        ###################################################################
        #   Now Speak over the micro phone so that Lakshya would hear and
        #   and respond back
        ###################################################################
print "Say Something"
        os.system('espeak "Hi Neelkanth.. I am Lakshya"')
      
#listens for the user's input
audio = r.listen(source)
try:
text = r.recognize_google(audio)
print "you said: " + text
#error occurs when google could not understand what was said
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))

you would get an output like the below. the first one in the list will we your mic connected to USB sound card

*********************************************************************
[u'USB PnP Sound Device: Audio (hw:0,0)',    -----> this one is the mic 
u'USB Device 0x46d:0x825: Audio (hw:1,0)', 
u'bcm2835 ALSA: - (hw:2,0)', u'bcm2835 ALSA: 
IEC958/HDMI (hw:2,1)', 
u'sysdefault', 
u'front', 
u'surround40', 
u'iec958', 
u'spdif', 
u'dmix', 
u'default']
*********************************************************************

######################################################################
What happens when the program is stuck at r.listen ??? and how to resolve it.
######################################################################
check the input volume of your microphone.
It is by default set to 0. 
 

If the program gets stuck on the line "
audio = r.listen(source)",  this simply means that 
the microphone is not able to listen to any voice 
 input.

The "listen" function has problems 
with environment noise. 
So the running code is only blinking waiting.

Use this ambient noise suppression/adjustment;  
r.adjust_for_ambient_noise(source, duration=5)

How to record and play recorded audio in raspberry pi [Provided USB sound card is connected]
arecord temp.wav 

Use the following commands to record and play using alsa-utils: 
arecord --device=plughw:0,0 --format S16_LE --rate 44100 -c1 test.wav
aplay --device=plughw:0,0 test.wav


4. 
#####################################################################
Speech to Text : This works !!!
#####################################################################
To convert the text to speech, install 'ESpeak' utility.
apt-get install espeak

To test espeak,  invoke the espeak command with some text.
espeak "Hello World"

Setting for Female Voice [in Text to speech] 
espeak -ven-us+f4 -s170  "I am rockstar"

Use the -v option to specifiy a voice. After that you can provide the type of language, such as en or en-us. 
After that, add a plus, then either m or f, 
and a 1 – 5. 
The s option lets you set the speed. Unfortunately, most of the voices sound pretty bad…


###################################################################
TExt to speech python API's
###################################################################
sudo pip install pyttsx    [ No internet Needed for this ]

Python Code
import pyttsx
engine = pyttsx.init()
voices = engine.getProperty('voices')
engine.setProperty('voice',  'english+f5')
engine.say(text)
engine.runAndWait()
time.sleep(1)

sudo pip install gTTS     [ Google API's. Internet Needed for this. but voice clarity 
is awesome ]

Python code
from gtts import gTTS
import os
tts = gTTS(text='Good morning', lang='en')
tts.save("good.mp3")
os.system("mpg321 good.mp3")

#########################################################################
Using especk in python code:  [TTS]
#########################################################################
import os
text = "Hi Neelkanth.   How are you doing"
cmd_string = 'espeak -ven+f5 "{0}" >/dev/null'.format(text)
print cmd_string
os.system(cmd_string)


C Program to save address of a pointer in a variable



C Program to save address of a pointer in a variable and some malloc examples

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void main()
{
    /*******************************************************************************
     * C program to save the 'address of a pointer' in a 'variable'.
     *******************************************************************************/
    int a1;
    int *b = &a1;
    /* variable 'c' to store a pointer's address. */
    long int c;
    c = (long int)b;
    printf("%p\n", (void *)c);
    printf("0x%lx \n", c);

    /*******************************************************************************
     * C program to save the 'address of pointer' in a variable and
     * free the address saved in the variable, by using that variable, instead
     * of original pointer.
     *******************************************************************************/
    int *ptr = NULL;
    ptr = (int *)malloc(100 * sizeof(int));
    long int g = (long int)ptr;
    printf("ptr: 0x%lx  g:0x%lx \n", (long int)ptr, g);
    free((int *)g);
    ptr = NULL;

    printf("ptr: 0x%lx  g:0x%lx \n", (long int)ptr, g);

    /********************************************************************************
     * C program to validate if we write to heap memory beyond allocated heap memory.
     * ONE SHOULD NEVER DO THAT, BUT THIS JUST FOR SAKE OF EXPERIMENTATION
     ********************************************************************************/
    char *ptr_1 = NULL;
    ptr_1 = (char *)malloc(10 * sizeof(char));
    strcpy(ptr_1, "neelkanth3neelkanth3neelkanth3neelkanth3neelkanth3neelkanth3neelkanth3");

    printf("ptr_1 : %s\n", ptr_1);


  /******* memcpy and malloc  ********************************/
    char *x = NULL;
    /* total allocated size is 14 bytes.  */
    x = (char *)malloc(14 * sizeof(char));
    memcpy(x, "1234", sizeof("1234"));
    memcpy(x+4, "neelkanth", sizeof("neelkanth"));

    printf("the malloced string is :%s \n", x);

    /*******************************************************************/


    return ;
}

Output:

0x7ffe0b07e45c
0x7ffe0b07e45c
ptr: 0xb85010  g:0xb85010
ptr: 0x0  g:0xb85010
ptr_1 : neelkanth3neelkanth3neelkanth3neelkanth3neelkanth3neelkanth3neelkanth3
the malloced string is :1234neelkanth