Skip to main content

Posts

Showing posts with the label Linux

Tips for Linux Kernel scheduling,shutdown and restart command,steps to kernel updating

 kernel scheduling in Linux In kernel you have kernel threads. Some part of the kernel code runs in the userspace process context and some other part runs in the kernel thread context. All the userspace processes and kernel threads are scheduled with no difference except that their priority(that is both userspace process and kernel threads are treated same). we can change the kernel with our algorithm.. algorithm in sence round robin,shortest job first, fcfs, etc. You have a mirror or some part (dono the exact name) in kernel where you store your algorithm. and make kernel work in your algorithm. If your algorithm works fine without crashing the system you can set ur algorithm as default overwriting the existing one. Its possible to write your own algorithm too. scheduler schedules processes either it may be user or kernel, all user and kernel processes are same and kernel treats them in the same manor,except kernel process will not be swapped out, kernel process will have mor

Restoring Sun with No Configuration Information

You can still get some information from your dump tapes, and with a couple of educated guesses, you can get the system up and running. There are a couple of ways to proceed. If you have another system, and you have some spare disk space, you can start to gather some information while the hardware guy is replacing the disk drive. On the second system, create a directory on a file system that has at least 15 MB free. You probably won't use that much, but a little extra space never hurts. In a crunch, you could probably get by with 5 MB or less. Let's call the directory /hope (because we hope we can get some information out of this). We are going to use the interactive option to ufsrestore (this option is also in restore under Sun OS, but I will use the Solaris versions here) to extract the vfstab from the dump tape. Use the following commands: # cd /hope # ufsrestore -ivf /dev/rmt/0 Verify volume and initialize maps More messages concerning block size, date of the dump,

Restoring Solaris steps using boot prompt commands

From the boot prompt (the 'OK' prompt) type: OK boot cdrom -s When the system has booted up, you should be at a shell prompt. You'll need to partition the disk using format. # format c0t0d0 You will see the format menu. It is usually not necessary to actually format the disk, since almost all SCSI disks are preformatted at the factory. We simply need to repartition the disk. Select the partition option: format> partition You will see the partitioning menu. Enter the following commands, using the printout of your previous partition layout in that machine's logbook as a guide. (See comments about partition sizes later in this article if you don't have such a record.) partition> 0 Enter partition id tag[root]: Enter partition permission flags[wm]: Enter new starting cyl[0]: Enter partition size[??b, ??c, ??mb, ??gb]: Repeat this process for all the other slices on the disk. Be sure to zero out any unused slices on the disk to avoid problems later.

how to use idea net setter in linux 10.0 desktop

how to use idea net setter in linux 10.0 desktop plug idea net setter in ubuntu create network connection on the bar set as idea create mobile brodband idea connection open cd rom idea net setter> goto Linux folder> extract file " Mobilepartner.tar.tg" on the desktop after extract files goto driver folder and Ndis driver a file-Ndis install double click on the file and run with terminal then back install file run with terminal then run these files 1.Start mobile partner 2.usb mode through terminol after that goto driver folder and run in terminal mobilepartner then restart your system and login again you enjoy with Idea Net Setter

Privilege Levels in processor and Virtual Memory

Privilege Levels in processor and Virtual Memory Privilege Levels: The processor has Ring Levels 0-3, 0 being most privileged, 3 being least privileged. All processes in user land, be it root or non-root, execute in Ring 3. (Ring 1,2 are unused in Linux) A process in Privilege level 3 cannot read/write/execute segments which belong to supervisor (the kernel). So a write to memory locations higher than PAGE_OFFSET (3GB on i386) causes segmentation fault. Same goes for hardware access through in/out or mapped i/o (exceptions are iopl etc). Virtual Memory: Virtual Memory ensures no access to physical RAM pages by processes. Hence you *cannot* under any circumstances write a physical address, Hence there is ZERO chance of even reading kernel data, let alone messing them up.

how to handle file descriptor on linux and file handler on windows platform

Open files in Linux are represented by struct files_struct (process view) struct file (kernel view)(file descriptor).when a file is opened.links between file descriptor, inode,address pace etc are created(i.e struct file is filled properly ) This is the work of virtual file system.. if code from windows has to be accessed in Linux..(possible because..it support NTFS file system). actually the file system(The NTFS file system is converted into ext form by virtual file system) so it is possible in Linux to access window stuff. On the other hand windows does not support any other file system .so accessing Linux files on windows in not possible.(i mean without any external tool).

print the source and destination address using kernel-2.6.32.9

main() { int pack_socket,n; int len,datasize; char src_addr[20],dst_addr[20],*data; struct sockaddr_ll sa; socklen_t sl; struct iphdr *ip_hdr; char buf[2000]; struct in_addr addr; pack_socket = socket(PF_PACKET,SOCK_DGRAM,htons(ETH_P_ALL)); while(1){ sl = sizeof(struct sockaddr_ll); n = recvfrom(pack_socket,buf,2000,0,(struct sockaddr *)&sa,&sl); //check whether the packet is ip or not. if(ntohs(sa.sll_protocol) == 0x0800){ printf(" IP packet received \n"); ip_hdr = (struct iphdr *) buf; addr.s_addr = ntohl(ip_hdr->saddr); printf("\n Source Addr = %s", inet_ntoa(addr)); addr.s_addr = ntohl(ip_hdr->daddr); } } }

What is Virtual Memory and How it works?

What is Virtual Memory and How it works? Virtual Memory allows multi-user as well as multi-programming computing environment that too for very less RAM. RAM use to be very costly earlier compare to present day. CPU has PC register from where next instruction can be fetched or data can be load/store. Assuming PC being 32 bit register, it can address 4G locations. But practically we put very less RAM, say 128MB only. Assuming Virtual Memory exists, compiler generates code for an application, where compiler is also aware of OS+Architecture. Now code generated by compiler assumes entire 4G location (so large extent) is available for it and it is the only application running on the CPU. So PC register shall always issue address which is one among 4G locations. So this 4G which is in fact physical capacity of PC register of CPU, is used as Virtual Address, as actual RAM is much less (0-128MB only) Now OS uses a table call Page Table along with MMU unit of CPU. Using this it loa