调试脚本
什么unexpect end of file
明明知道哪少个括号,硬是找不到
最后一个函数一个函数地copy到另一个script
终于找到原因
因为 一个 大括号 写到一行的末尾
而不是另一行的开始
由于vi的显示却正好像是一行的开始
虽然颜色是不一样的,但是红和紫并不容易分辨
shift+%方法找匹配也能找到
TNND vi
什么unexpect end of file
明明知道哪少个括号,硬是找不到
最后一个函数一个函数地copy到另一个script
终于找到原因
因为 一个 大括号 写到一行的末尾
而不是另一行的开始
由于vi的显示却正好像是一行的开始
虽然颜色是不一样的,但是红和紫并不容易分辨
shift+%方法找匹配也能找到
TNND vi
给eclipse写了个plugin,就一句helloworld
照着网上介绍的文章一步一步来
很顺利,只是后来发现只能在run as workspace里能看到结果
真copy到eclipse的plugins目录就没有
google了一整天
才找到一个人写到了window -> Customize Prespective -> Other里去
turn on,否则默认不会出来地
难道他们那些写文章的人都不真正把自己写的plugin拿出来用吗?
安装了 eclipse,结果启动的时候出现Problems during startup的dialog,遍寻
google而无解,奇怪,很多人也遇到过,很多人据说是不知怎么多启动
几次就好了,完全是搞封建迷信。
只好自己解决,最后是发现要启动参数如下:
eclipse -vm /usr/java/jdk/bin/java
才行
当然,jdk要有
Linux has a unique implementation of threads. To the Linux kernel, there is no concept of a thread. Linux implements all threads as standard processes. The Linux kernel does not provide any special scheduling semantics or data structures to represent threads. Instead, a thread is merely a process which shares certain resources. Each thread has a unique task_struct and appears to the kernel as a normal process (which shares resources, such as an address space, with other processes).
This approach to threads contrasts greatly with operating systems such as Microsoft Windows or Sun Solaris, which have explicit kernel support for threads (and sometimes call threads lightweight proesses). The name “lightweight process” sums up the difference in philosophies between Linux and other systems. To these other operating systems, threads are an abstraction to provide a lighter, quicker execution unit that the heavy process. To Linux, threads are simply a manner of sharing resoures between processes.
Threads are created like normal tasks with the exception that the clone() system call is passed flags corresponding to specific resources to be shared:
clone( CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, 0 ) ;
The Process Descriptior and Task Structure
The kernel strores the processes in a circular doubly linked list called the task list. Each element in the task list is a process descriptor of the type struct task_struct, which is defined in include/linux/sched.h. The process deescriptor contains all the information about a specific process.
The task_struct is a relatively large data structure at around 1.7 kilobytes on a 32-bit machine. This size, however, is quite small considering that the structure contains all the information the kernel needs about a process. The process descriptor contains the data that describe the executing program — open files, the process’s address space, pending signals, the process’s state, and much more.
Allocating the Process Descriptor
The task_struct is allocated via the slab allocator to provide object reuse and cache coloring. Prior to the 2.6 kernel series, the task_struct was stored at the end of the kernel stack of each process. This allowed architectures with few registers, such as x86, to calculate the location of the process descriptor via the stack pointer without using an extra register to store the location. With the process descriptor now dynamically created via the slab allocator, a new structure, struct thread_info, was created that again lives at the bottom of the stack (for stacks that grow down) or at the top of the stack (for stacks that grow up).
Each task’s thread_info structure is allocated at the end of its stack. The task element of the structure is a pointer to the task’s actual task_struct.
Storing the Process Descriptor
The system identifies processes by a unique proess identification value or PID. The PID is a numerial value that is represented by the opaque type pid_t, which is typially an int. Because of backward compatibility with earlier Unix and Linux versions, however, the default maximum value is on 32767 (that of a short int). The kernel stores this value as pid inside each process descriptor.
If the system is willing to break comatibility with old applications, the administrator may increase the maximum value via /proc/sys/kernel/pid_max.
Contrast this approach with that taken by PowerPC, which stores the current task_struct in a register. Thus, current on PPC merely returns the value stored in the register r2. PPC can take this approach because, unlike x86, it has plenty of registers. Because accessing the process descriptor is a common and important job, the PPC kernel developers deem using a register worthy for the task.
Processes provide two virtualizations: a virtualized processor and virtual memory. The virtual processor gives the process the illusion that it alone monopolizes the system, despite possibly sharing the processor amongst dozens of other processes. Virtual memory lets the process allocate and manage memory as if it alone owned all the memory in the system.
Note that a program itself is not a process; a process is an active program and related resources. Indeed, two or more processes can exist that are executing the same program. In fact, two or more processes can exist that share various resources, such as open files or an addressspace. A process beins its life when, not surprisingly, it is created. In Linux,this occurs by means of the fork() system call, which creates a new process by duplicating an existing one. The process that calls fork() is the parent, whereas the new process is the child. The parent resumes execution, and the child starts execution, at the same place, where the call returns. Often, following a fork it is desirable to execute a new, different, program. The exec() – family of funcation calls is used to create a new address space and load a new program into it.
Finally, a program exits via the exit() system call. This function termiates the process and frees all its resources. A parent process can inquire about the status of a terminated child, via the wait4() system call that enables a process to wait for the termination of a specific process. When a process exits, it is placed into a special zombie state that is used to represent terminated processes until the parent calls wait() or waitpid().
A Beast of a Different Nature
Linux Versus Classic Unix Kernels
apt-get error
若apt-setup出現”E:Dynamic MMap ran out of room”錯誤,在/etc/apt/apt.conf
加入
APT
{
Cache-Limit “141943904″
}
增加cache的可用空間。
google来的,来自台湾龍潭國小drbl學習日誌
装了debian 3.0的第一张盘,只有基本系统
印象里安装过程没有问过我要不要设网卡IP什么的
启动之后发现只有lo
ifconfig -a后发现eth0设成了自动ip
只好自己改interfaces的内容再ifup什么的
问题:我现在家里用一台台式机ADSL上网,做Proxy Server
IP地址是192.168.0.1,DNS,GATEWAY都是它
笔记本固定IP地址设好后,能ping到192.168.0.1的机器
ping 不通外边的名字或地址
但是我用base-config,tasksel居然可以下载pkg!
我虽然可以下载了,但是另一个console仍然不能ping通外边