Navid Malekghaini's Personal Blog

My personal weblog for sharing and storing some of my activities related to computer science over the internet

Navid Malekghaini's Personal Blog

My personal weblog for sharing and storing some of my activities related to computer science over the internet

Navid Malekghaini's Personal Blog

Navid Malekghaini

Software Engineer @ Intelligent Cloud Infrastructure Laboratory
Prev. ML Researcher @ University of Waterloo x Orange Telecom

University of Waterloo
Department of computer science
200 University Ave W, Waterloo, ON N2L 3G1, Canada
cs.uwaterloo.ca

contact me
navidmalekedu (AT) gmail (DOT) com [ Primary Email ]
nmalekgh (AT) uwaterloo (DOT) ca

 

Part 2.2

Finding specified information and necessary functions to implement desired module

​​Download full tutorial from here

Goal:

  • find start and end of code segment in memory for a process

  • find start and end of data segment in memory for a process

  • find BSS virtual address for process

  • find entry point of a process

​​Download full tutorial from here

موافقین ۰ مخالفین ۰ 29 September 17 ، 08:25

Part 2.1

Implementation of Simple “hello world” Module and Run


 

TO GET THE FULL TUTORIAL CLICK HERE

Every module structure have two major functions:

  1. init

  • executed when the module is loaded into kernel

  1. cleanup

  • executed when the module is removed from kernel

the simple module implementation is here:



TO GET THE FULL TUTORIAL CLICK HERE

موافقین ۰ مخالفین ۰ 29 September 17 ، 04:00

1) what is pipe?

Pipe man page :

«pipe()  creates  a pipe, a unidirectional data channel that can be used for interprocess communication. The array pipefd is used to return two file  descriptors  referring to the ends of the pipe. pipefd[0]  refers  to the read end of the pipe. pipefd[1] refers to the write end of the pipe.  Data written to the write end of  the pipe is buffered by the kernel until it is read from the read end of the pipe. For further details, see pipe(7).»

 

2)Creating half-duplex communication between parent and child:


 

the code and output:


 

description:

The child closes it’s write (fd[1]) and then reads from fd[0] into readForChild buffer and prints the output.

The parent closest it’s read(fd[0]) and then writes into writeForParent buffer and then passes the address to the fd[1].

 

 

More complicated Half-Duplex communication:

 

read comments for better undrstanding.

موافقین ۰ مخالفین ۰ 13 August 17 ، 10:21

Hi,

Recently i've started to learn some web development, after searching and asking some of my friends which are expert in web development, i've chosen this materials for Front End and Back End development.

Also these are the required skills for my web Project.

 

Front End :

 

Language = persian

cost = not free 

time = 62 hours

topics ==>

                 HTML 5

                 CSS 3 

                 JavaScript & JQuery

                 Interactive design ( Bootstrap ...)

 

 

 

Link = https://plus.maktabkhooneh.org/course/

 

Back End:

Language : English

cost = monthly

time = up to 15 hours

topics ==>

               PHP 7.1

               Symphony 3.3 framework

 

Link = https://knpuniversity.com/tracks/symfony#starting-in-symfony-3

موافقین ۰ مخالفین ۰ 03 August 17 ، 01:20

Part 1.3

implementing user and kernel program

 

TO GET THE FULL TUTORIAL YOU CAN EMAIL ME

 

What we want to do :


in this section we want to implement kernel program through system calls to gather the information we want, we aslo want to implement simple user space program in C language to call our systemcall and show it in nice format to the user.

the idea here is simple I show the concept and steps here, after that I will implement them one by one.

Idea:

All we should do is the user space and kernel space point to the same RAM address like this:


 

so we should pass our structs by reference to system call, like bellow:



now we have the value of every thing that has changed in kernel mode.

 

TO GET THE FULL TUTORIAL YOU CAN EMAIL ME

 
موافقین ۰ مخالفین ۰ 15 July 17 ، 03:20

Part 1.2

finding the important functions which gather information about some hardware's

DOWNLOAD FULL TUTORIAL WITH IMAGES FROM HERE

 

list of hardwares:

  • CPU

  • Memory

  • network interface

  • sound card

  • power supplier

inorder to implement our information on system we should find :

  1. what are the type of variables we want?

  2. What is implementing them?

  3. Where are they defined?

  4. How to implement from number 2, to number 1?

so in this part we have to answer these 4 questions.

 

DOWNLOAD FULL TUTORIAL WITH IMAGES FROM HERE

 
موافقین ۰ مخالفین ۰ 14 July 17 ، 03:12

Part 1.1

Adding simple system call to kernel from scratch


 

DOWNLOAD FULL TUTORIAL WITH IMAGES FROM HERE

First create a directory named linuxSRC to download linux source, and Change directory to the folder:

console:

mkdir /linuxSRC
cd linuxSRC

 

after that you should first download the linux source, inorder to download every source on the package repository of ubuntu you should go to your package list ,You need to uncomment the deb-src lines in the main file /etc/apt/sources.list not the extra files in/etc/apt/sources.list.d:
open software & updates
go to ubuntu software tab
check source code
save and exit

 

after that you should get your current version linux kernel and build dependencies:

console:

 

mkdir newKernel
cd newKernel

 

now download the linux source and decompress it:

console:

 

sudo apt-get install linux source
tar xjvf /usr/src/linux-source-<yourversion>tar.bz2

now go to the specified folder bellow :

 

/home/nubuntu/linuxSRC/linux-source-4.4.0/arch/x86/entry/syscalls

now open syscall_64.tbl or syscall_32.tbl (based on your system)(i use 64)

at the end add your hello syscall after the last number (here 333), with the following format, save and exit.
 

from here the tutorial have images, so I've created a nice PDF document with screen shots to download.

DOWNLOAD FULL TUTORIAL WITH IMAGES FROM HERE

 
موافقین ۰ مخالفین ۰ 11 July 17 ، 06:42




in these series of tutorials i want to play with Linux kernel and Loadable Kernel Modules (LKM) along with getting basic information about kernel architecture and system calls (part 1) , proc file system and processes information's (part 2), these tutorials are adopted from my operating system's class project.

there are two major parts as i mentioned before:

 
  1. Linux kernel (focusing on system calls)
  • Building kernel from source with adding a simple system call
  • Finding specified devices information and necessary functions to implement them
  • How to implement the system call and user space program to get info on specified drivers from kernel

     2. Loadable Kernel Modules (focusing on Proc File system)

  • Implementation of simple “hello world” module and run
  • Finding specified information and necessary functions to implement desired module
  • Implementation of desired kernel module and user program

requirements:

  • Ubuntu version: 16.04.2 (recommended not required)

  • Linux kernel : 4.x.x

  • Internet connection

  • about 30 or 40 gigabytes of space (first part)

  • lots of time for compile ! (first part)



i will start from the simple system call in the next post.

navidx
موافقین ۰ مخالفین ۰ 11 July 17 ، 06:12

Hi, its been a while since last post! guess what!? the blog will be updated from 6th of July (15 tir in Persian calendar)
there will be posts about operating systems, computer architecture , Data structures and so on.... 
so stay thirsty!
thanks
navidx

موافقین ۰ مخالفین ۰ 04 June 17 ، 09:53

!hi
 the second class im attending as TA is the dr.taherkhani's class for Electrical And Mechanical Engineering
the picture above are the list of the TA's and the responsibilities for each one of them
im the head of Quizzes section and programming trainer and teacher

 the class will be held from 18th mehr(9th october) on Wednesdays from 10 to 12 o'clock in the morning

the page Course is here 
http://ce.sharif.edu/courses/95-96/1/ce153-6/

:Note

the picture is updated,to see the previous picture click here

موافقین ۰ مخالفین ۰ 06 October 16 ، 06:00

!hi for the third time

  so there is a Fundumentals of Programming course for the Physics and Industrial Engineering 
Codenamed CE 40153
(As you see im currently one of the TA's in this course (the fourth one from above in TA's Section
the Instructor is Ebrahim Jahandar - currently a phd Student @ Sharif University Of Technology
his Personal recordings and activities can be found here 
http://www.jahandar.ir/about/about-ebrahim-jahandar/
the Course page is here
http://ce.sharif.edu/courses/95-96/1/ce153-12/index.php/section/syllabus/file/syllabus

موافقین ۰ مخالفین ۰ 03 October 16 ، 04:11


hello again!
so its close to the end of summer and the opening of universities is close
this semester one of my challenging courses is Computer Architecture which is one of the most be-loving courses for me too
for this course  there are also videos on maktabkhooneh web-site that can help you study online.
the teacher is maziar goudarzi - asistatnt professor @ Sharif university of technology

the picture is the screen shot of the video on maktabkhooneh!
here is the link! 

موافقین ۰ مخالفین ۰ 10 September 16 ، 01:10

 

 
!hello
!this is my first post 
 
i will put my career or even interesting things that come to me here

 

.till now i dont know whether to write in english or persian but i think i would prefer english
 
.so this is it
this site will be updated from tommorow
 
navidX
موافقین ۰ مخالفین ۰ 08 September 16 ، 03:11