1. //第一层系统调用
    1. asmlinkage long sys_exit(int error_code)
    1. {
    1. do_exit((error_code&0xff)<<8);
    1. }

其主体是do_exit,接下来我们来看看do_exit的实现
    1. NORET_TYPE void do_exit(long code)
    1. {
    1. struct task_struct *tsk = current;//获取当前进程描述符
    1. if (in_interrupt())//禁止中断时调用do_exit
    1. panic("Aiee, killing interrupt handler!");
    1. if (!tsk->pid)//空转进程也就是0号进程禁止退出
    1. panic("Attempted to kill the idle task!");
    1. if (tsk->pid == 1)//1号进程禁止退出
    1. panic("Attempted to kill init!");
    1. tsk->flags |= PF_EXITING;//退出进程时,设置此标志位
    1. /*
    1. 进程退出时,可能已经设置了实时定时器,real_timer已挂载到内核定时器队列,
    1. 现在进程要退出,没必要存在了,就把当前进程从定时器队列中脱离出来
    1. */
    1. del_timer_sync(&tsk->real_timer);
    1. fake_volatile:
    1. #ifdef CONFIG_BSD_PROCESS_ACCT
    1. acct_process(code);
    1. #endif
    1. /*如果是指针共享,那就只是减少mm->mm_users,
    1. 如果有独立的进程空间,那就直接释放页表,mm_struct,vm_struct
    1. 以及所有的vma*/
    1. __exit_mm(tsk);
    1. //加锁
    1. lock_kernel();
    1. //如果调用exit()之前该信号量还没退出,那就把它撤销
    1. sem_exit();
    1. //如果只是指针共享,那就减少files_struct->count,如果是独享,那就销毁
    1. __exit_files(tsk);
    1. //以上相同,释放fs->count
    1. __exit_fs(tsk);
    1. //释放信号处理函数表
    1. exit_sighand(tsk);
    1. //空函数
    1. exit_thread();
    1. ///表示进程是否为会话主管
    1. if (current->leader)
    1. disassociate_ctty(1);//删除终端,释放tty
    1. //若正在执行的代码是符合iBCS2标准的程序,则减少相对应模块的引用数目
    1. put_exec_domain(tsk->exec_domain);
    1. /* 若正在执行的代码属于全局执行文
    1. 件结构格则减少相对应模块的引用数目 */
    1. if (tsk->binfmt && tsk->binfmt->module)
    1. __MOD_DEC_USE_COUNT(tsk->binfmt->module);
    1. tsk->exit_code = code;
    1. //将当前进程设置为僵死状态;并给父进程发信号;其当前进程的子进程的父进程设置为init进程或者其他线程
    1. exit_notify();
    1. schedule();
    1. BUG();
接着挨个分析释放资源相关函数(信号量就等到进程间通信学完再分析)
    1. static inline void __exit_mm(struct task_struct * tsk)
    1. {
    1. struct mm_struct * mm = tsk->mm;//获取当前进程的内存描述符
    1. mm_release();//唤醒睡眠的父进程
    1. if (mm) {
    1. atomic_inc(&mm->mm_count);
    1. if (mm != tsk->active_mm) BUG();//确保mm与active_mm一样
    1. /* more a memory barrier than a real lock */
    1. task_lock(tsk);
    1. tsk->mm = NULL;//设置为NULL
    1. task_unlock(tsk);
    1.      //刷新tlb
    1. enter_lazy_tlb(mm, current, smp_processor_id());
    1. mmput(mm);//释放页表等等
    1. }
    1. }
以上资源释放完后,进程设置为僵尸状态,还保留pcb以及内核栈,自己并不释放而是由父进程负责,将调用exit_notify()通知其父进程
原因:让父进程可以统计信息,接下来看看exit_notify()
    1. /*
    1. * Send signals to all our closest relatives so that they know
    1. * to properly mourn us..
    1. */
    1. static void exit_notify(void)
    1. {
    1. struct task_struct * p, *t;
    1. //其当前进程的子进程的父进程设置为init进程,如果父进程是线程,那就托孤给其他线程
    1. forget_original_parent(current);
    1. /*
    1. * Check to see if any process groups have become orphaned
    1. * as a result of our exiting, and if they have any stopped
    1. * jobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2)
    1. *
    1. * Case i: Our father is in a different pgrp than we are
    1. * and we were the only connection outside, so our pgrp
    1. * is about to become orphaned.
    1. */
    1. t = current->p_pptr;//获取其养父
    1. /*
    1. 如果当前进程与父进程属于相同的会话,又处于不同的组,当前进程挂了,整个组如果成了孤儿组,那就要
    1. 给这个进程组的所有进程发送一个SIGHUP跟SIGCONT信号
    1. */
    1. if ((t->pgrp != current->pgrp) &&//组不同而会话相同
    1. (t->session == current->session) &&
    1. will_become_orphaned_pgrp(current->pgrp, current) &&//判断是否是孤儿进程组
    1. has_stopped_jobs(current->pgrp)) {////如果进程组中有处于TASK_STOP状态的进程
    1. kill_pg(current->pgrp,SIGHUP,1);//先发送SIGHUP在发送SIGCONT
    1. kill_pg(current->pgrp,SIGCONT,1);
    1. }
    1. /* Let father know we died
    1. *
    1. * Thread signals are configurable, but you aren't going to use
    1. * that to send signals to arbitary processes.
    1. * That stops right now.
    1. *
    1. * If the parent exec id doesn't match the exec id we saved
    1. * when we started then we know the parent has changed security
    1. * domain.
    1. *
    1. * If our self_exec id doesn't match our parent_exec_id then
    1. * we have changed execution domain as these two values started
    1. * the same after a fork.
    1. *
    1. */
    1. if(current->exit_signal != SIGCHLD &&
    1. ( current->parent_exec_id != t->self_exec_id ||
    1. current->self_exec_id != current->parent_exec_id)
    1. && !capable(CAP_KILL))
    1. current->exit_signal = SIGCHLD;//给父进程发的信号是SIGCHLD /*
    1. * This loop does two things:
    1. *
    1. * A. Make init inherit all the child processes
    1. * B. Check to see if any process groups have become orphaned
    1. * as a result of our exiting, and if they have any stopped
    1. * jobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2)
    1. */
    1. write_lock_irq(&tasklist_lock);
    1. current->state = TASK_ZOMBIE;//设置为僵尸进程
    1. do_notify_parent(current, current->exit_signal);//由父进程来料理后事
    1. //将子进程队列中的每个进程都转移到托孤的父进程的子进程队列中去
    1. while (current->p_cptr != NULL) {//p_cptr表示子进程
    1. p = current->p_cptr;//p指向子进程
    1. current->p_cptr = p->p_osptr;//子进程指向子进程他哥,形成一个队列
    1. p->p_ysptr = NULL;//子进程的滴滴设置为0
    1. p->ptrace = 0;
    1. p->p_pptr = p->p_opptr;//将养父改为亲父
    1. p->p_osptr = p->p_pptr->p_cptr;//子进程的哥哥改为子进程的养父的子进程,移到子进程队列
    1. if (p->p_osptr)
    1. p->p_osptr->p_ysptr = p;
    1. p->p_pptr->p_cptr = p;
    1. if (p->state == TASK_ZOMBIE)//并且判断每个子进程是否是僵尸状态
    1. do_notify_parent(p, p->exit_signal);
    1. /*
    1. * process group orphan check
    1. * Case ii: Our child is in a different pgrp
    1. * than we are, and it was the only connection
    1. * outside, so the child pgrp is now orphaned.
    1. 孤儿进程组: 一个进程组中的所有进程的父进程要么是该进程组的一个进程,
    1. 要么不是该进程组所在的会话中的进程。 一个进程组不是孤儿进程组的条件是,
    1. 该组中有一个进程其父进程在属于同一个会话的另一个组中。
    1. */
    1. if ((p->pgrp != current->pgrp) &&
    1. (p->session == current->session)) {
    1. int pgrp = p->pgrp;
    1. write_unlock_irq(&tasklist_lock);
    1. //父进程所在的组是否是孤儿进程组,以及是否含有stop进程
    1. if (is_orphaned_pgrp(pgrp) && has_stopped_jobs(pgrp)) {
    1. kill_pg(pgrp,SIGHUP,1);
    1. kill_pg(pgrp,SIGCONT,1);
    1. }
    1. write_lock_irq(&tasklist_lock);
    1. }
    1. }
    1. write_unlock_irq(&tasklist_lock);
    1. }
子进程托孤给其他进程(如果该进程是线程,也就是含有其他线程),否则托孤给init进程
    1. /*
    1. * When we die, we re-parent all our children.
    1. * Try to give them to another thread in our process
    1. * group, and if no such member exists, give it to
    1. * the global child reaper process (ie "init")
    1. */
    1. static inline void forget_original_parent(struct task_struct * father)
    1. {
    1. struct task_struct * p, *reaper;
    1. read_lock(&tasklist_lock);
    1. /* 获取当前用户空间的下一线程 */
    1. reaper = next_thread(father);
    1. if (reaper == father)//如果相等说明是进程,不是线程组,那就只能托孤给init进程
    1. reaper = child_reaper;//init进程
    1. for_each_task(p) {
    1. if (p->p_opptr == father) {//搜索所有task_struct数据结构,发现其进程生父就是要退出的进程
    1. /* We dont want people slaying init */
    1. p->exit_signal = SIGCHLD;//设置发送信号
    1. p->self_exec_id++;
    1. p->p_opptr = reaper;//将要死的进程的子进程托孤给reaper(当前线程的其他线程或者init进程?
    1. if (p->pdeath_signal) 
    1.             send_sig(p->pdeath_signal, p, 0);//发送信号,告知儿子死了
    1. }
    1. }
    1. read_unlock(&tasklist_lock);
    1. }


接下来查看do_notify_parent发送信号给父进程
    1. /*
    1. * Let a parent know about a status change of a child.
    1. 让一个父亲知道有关儿子的改变
    1. 参数为当前要退出进程,以及信号
    1. */
    1. void do_notify_parent(struct task_struct *tsk, int sig)
    1. {
    1. struct siginfo info;
    1. int why, status;
    1. info.si_signo = sig;
    1. info.si_errno = 0;
    1. info.si_pid = tsk->pid;
    1. info.si_uid = tsk->uid;
    1. /* FIXME: find out whether or not this is supposed to be c*time. */
    1. info.si_utime = tsk->times.tms_utime;
    1. info.si_stime = tsk->times.tms_stime;
    1. status = tsk->exit_code & 0x7f;
    1. why = SI_KERNEL; /* shouldn't happen */
    1. switch (tsk->state) {
    1. case TASK_STOPPED:
    1. /* FIXME -- can we deduce CLD_TRAPPED or CLD_CONTINUED? */
    1. if (tsk->ptrace & PT_PTRACED)
    1. why = CLD_TRAPPED;
    1. else
    1. why = CLD_STOPPED;
    1. break;
    1. default:
    1. if (tsk->exit_code & 0x80)
    1. why = CLD_DUMPED;
    1. else if (tsk->exit_code & 0x7f)
    1. why = CLD_KILLED;
    1. else {
    1. why = CLD_EXITED;
    1. status = tsk->exit_code >> 8;
    1. }
    1. break;
    1. }
    1. info.si_code = why;
    1. info.si_status = status;
    1. send_sig_info(sig, &info, tsk->p_pptr);//发送信号
    1. wake_up_parent(tsk->p_pptr);//唤醒父进程
    1. }


    1. /*
    1. * This function is typically called only by the session leader, when
    1. * it wants to disassociate itself from its controlling tty.
    1. *
    1. * It performs the following functions:
    1. * (1) Sends a SIGHUP and SIGCONT to the foreground process group
    1. * (2) Clears the tty from being controlling the session
    1. * (3) Clears the controlling tty for all processes in the
    1. * session group.
    1. *当前进程是一个会话的主进程(current->leader非0)那就还要将整个session与中断切断,并释放tty,pcb有个tty指针
    1. * The argument on_exit is set to 1 if called when a process is
    1. * exiting; it is 0 if called by the ioctl TIOCNOTTY.
    1. */
    1. void disassociate_ctty(int on_exit)
    1. {
    1. struct tty_struct *tty = current->tty;//获取当前进程的tty
    1. struct task_struct *p;
    1. int tty_pgrp = -1;
    1. if (tty) {
    1. tty_pgrp = tty->pgrp;//获取进程组的tty
    1. if (on_exit && tty->driver.type != TTY_DRIVER_TYPE_PTY)//统计tty设备打开的次数
    1. tty_vhangup(tty);
    1. } else {
    1. if (current->tty_old_pgrp) {
    1. kill_pg(current->tty_old_pgrp, SIGHUP, on_exit);//给当前进程组发送sighup与sigcont信号
    1. kill_pg(current->tty_old_pgrp, SIGCONT, on_exit);
    1. }
    1. return;
    1. }
    1. if (tty_pgrp > 0) {
    1. kill_pg(tty_pgrp, SIGHUP, on_exit);
    1. if (!on_exit)
    1. kill_pg(tty_pgrp, SIGCONT, on_exit);
    1. }
    1. current->tty_old_pgrp = 0;//进程控制终端所在的组标识设置为0
    1. tty->session = 0;//会话设置为0
    1. tty->pgrp = -1;//组设置为-1
    1. read_lock(&tasklist_lock);
    1. for_each_task(p)//遍历每个进程是否位于同一会话
    1. if (p->session == current->session)//当前进程是会话的主进程
    1. p->tty = NULL;//切断tty终端
    1. read_unlock(&tasklist_lock);
    1. }
do_exit流程:
禁止中断调用,0号进程,1号进程退出
如果有独立空间那就删除独立空间,释放页表,释放信号量,释放文件对象,释放信号处理函数表
如果是会话控制进程,删除终端,释放tty,接下来调用exit_notify()函数
如果当前进程是是线程(也就包含其他线程,非独享),托孤给其他线程,否则托孤给init进程
判断当前进程退出是否会导致孤儿进程组出现
设置发送信号为SIGCHLD,将当前进程设置为僵尸状态,接着调用do_notify_parent发送信号给父进程,并唤醒父进程
并将僵尸进程的所有子进程的队列移到托孤的队列.最后shedule()


    1. //等待子进程的pid
    1. asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru)
    1. {
    1. int flag, retval;
    1. DECLARE_WAITQUEUE(wait, current);//为当前进程分配一个waitqueue结构
    1. struct task_struct *tsk;
    1. if (options & ~(WNOHANG|WUNTRACED|__WNOTHREAD|__WCLONE|__WALL))
    1. return -EINVAL;
    1. //添加到当前进程的waitchldexit对列中
    1. add_wait_queue(&current->wait_chldexit,&wait);
    1. repeat:
    1. flag = 0;
    1. current->state = TASK_INTERRUPTIBLE;//设置为睡眠,让其他进程先运行,等待子进程挂了
    1. read_lock(&tasklist_lock);
    1. tsk = current;
    1. do {
    1. struct task_struct *p;
    1. for (p = tsk->p_cptr ; p ; p = p->p_osptr) {//p表示当前进程的子进程
    1. if (pid>0) {
    1. if (p->pid != pid)//是否等于参数pid,不等于就继续
    1. continue;
    1. } else if (!pid) {//不是0号进程
    1. if (p->pgrp != current->pgrp)
    1. continue;
    1. } else if (pid != -1) {//不是-1(随便)
    1. if (p->pgrp != -pid)
    1. continue;
    1. }
    1. /* Wait for all children (clone and not) if __WALL is set;
    1. * otherwise, wait for clone children *only* if __WCLONE is
    1. * set; otherwise, wait for non-clone children *only*. (Note:
    1. * A "clone" child here is one that reports to its parent
    1. * using a signal other than SIGCHLD.) */
    1. //判断子进程的信号是否是sigchld
    1. if (((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0))
    1. && !(options & __WALL))
    1. continue;
    1. flag = 1;//表示是当前进程的子进程
    1. switch (p->state) {
    1. case TASK_STOPPED://等待子进程被跟踪
    1. if (!p->exit_code)//是否设置了退出码
    1. continue;
    1. if (!(options & WUNTRACED) && !(p->ptrace & PT_PTRACED))//判断条件是否跟踪
    1. continue;
    1. read_unlock(&tasklist_lock);
    1. retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
    1. if (!retval && stat_addr)
    1. retval = put_user((p->exit_code << 8) | 0x7f, stat_addr);
    1. if (!retval) {
    1. p->exit_code = 0;
    1. retval = p->pid;
    1. }
    1. goto end_wait4;//满足直接跳到end_wait4
    1. case TASK_ZOMBIE://僵尸状态
    1. current->times.tms_cutime += p->times.tms_utime + p->times.tms_cutime;
    1. current->times.tms_cstime += p->times.tms_stime + p->times.tms_cstime;
    1. read_unlock(&tasklist_lock);
    1. retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
    1. if (!retval && stat_addr)
    1. retval = put_user(p->exit_code, stat_addr);//指定位置保存退出码
    1. if (retval)
    1. goto end_wait4;
    1. retval = p->pid;
    1. if (p->p_opptr != p->p_pptr) {//生父与养父是否相同
    1. write_lock_irq(&tasklist_lock);
    1. REMOVE_LINKS(p);//将task_struct从养父队列中脱离出来
    1. p->p_pptr = p->p_opptr;//将养父设置为生父
    1. SET_LINKS(p);
    1. do_notify_parent(p, SIGCHLD);//通知生父进程自己挂了
    1. write_unlock_irq(&tasklist_lock);
    1. } else
    1. release_task(p);//释放残留的资源如pcb等等
    1. goto end_wait4;//子进程处于僵死状态,goto end_wait4
    1. default:
    1. continue;
    1. }
    1. }
    1. if (options & __WNOTHREAD)//如果设置了wnothread直接跳出
    1. break;
    1. tsk = next_thread(tsk);//到同一进程的寻找下一个线程,一线程创建的子进程挂了,其他线程调用wait应该没用吧?
    1. } while (tsk != current);
    1. read_unlock(&tasklist_lock);
    1. if (flag) {//如果pid不是当前进程的子进程,直接到end_wait4
    1. retval = 0;
    1. if (options & WNOHANG)//设置了wnohang
    1. goto end_wait4;
    1. retval = -ERESTARTSYS;
    1. if (signal_pending(current))//当前进程是否有信号未处理
    1. goto end_wait4;
    1. schedule();//被调度.等待被子进程唤醒
    1. goto repeat;
    1. }
    1. retval = -ECHILD;
    1. end_wait4:
    1. current->state = TASK_RUNNING;//将当前进程改为可运行状态
    1. remove_wait_queue(&current->wait_chldexit,&wait);
    1. return retval;
    1. }

下列条件之一得到满足时才结束,goto end_wait4:

1、所等待的子进程的状态变成TASK_STOPPED,TASK_ZOMBIE;

2、所等待的子进程存在,可不在上述两个状态,而调用参数options中的WHONANG标志位为1,或者当前进程接受到了其他的信号;

3、进程号pid的那个进程根本不存在,或者不是当前进程的子进程。

否则,当前进程将其自身的状态设成TASK_INTERRUPTIBLE,并调用schedule()。


释放残余的子进程资源
    1. static void release_task(struct task_struct * p)//释放子进程留下的资源
    1. {
    1. if (p != current) {
    1. #ifdef CONFIG_SMP
    1. /*
    1. * Wait to make sure the process isn't on the
    1. * runqueue (active on some other CPU still)
    1. */
    1. for (;;) {
    1. task_lock(p);
    1. if (!p->has_cpu)
    1. break;
    1. task_unlock(p);
    1. do {
    1. barrier();
    1. } while (p->has_cpu);
    1. }
    1. task_unlock(p);
    1. #endif
    1. atomic_dec(&p->user->processes);//子进程数目减少
    1. free_uid(p->user);//是否uid
    1. unhash_process(p);//把子进程的pcb从队列摘下来
    1. release_thread(p);//检查进程的LDT是否已释放
    1. current->cmin_flt += p->min_flt + p->cmin_flt;
    1. current->cmaj_flt += p->maj_flt + p->cmaj_flt;
    1. current->cnswap += p->nswap + p->cnswap;
    1. /*
    1. * Potentially available timeslices are retrieved
    1. * here - this way the parent does not get penalized
    1. * for creating too many processes.
    1. *
    1. * (this cannot be used to artificially 'generate'
    1. * timeslices, because any timeslice recovered here
    1. * was given away by the parent in the first place.)
    1. */
    1. current->counter += p->counter;
    1. if (current->counter >= MAX_COUNTER)
    1. current->counter = MAX_COUNTER;
    1. free_task_struct(p);//将2个物理页大小的pcb释放
    1. } else {
    1. printk("task releasing itself\n");
    1. }
    1. }








linux内核情景分析之exit与Wait的更多相关文章

  1. linux内核情景分析之execve()

    用来描述用户态的cpu寄存器在内核栈中保存情况.可以获取用户空间的信息 struct pt_regs { long ebx; //可执行文件路径的指针(regs.ebx中 long ecx; //命令 ...

  2. Linux内核情景分析之消息队列

    早期的Unix通信只有管道与信号,管道的缺点: 所载送的信息是无格式的字节流,不知道分界线在哪,也没通信规范,另外缺乏控制手段,比如保温优先级,管道机制的大小只有1页,管道很容易写满而读取没有及时,发 ...

  3. Linux内核情景分析之异常访问,用户堆栈的扩展

    情景假设: 在堆内存中申请了一块内存,然后释放掉该内存,然后再去访问这块内存.也就是所说的野指针访问. 当cpu产生页面错误时,会把失败的线性地址放在cr2寄存器.线性地址缺页异常的4种情况 1.如果 ...

  4. Linux内核情景分析的alloc_pages

    NUMA结构的alloc_pages ==================== mm/numa.c 43 43 ==================== 43 #ifdef CONFIG_DISCON ...

  5. linux内核情景分析之内核中的互斥操作

    信号量机制: struct sempahore是其结构,定义如下 struct semaphore { atomic_t count;//资源数目 int sleepers;//等待进程数目 wait ...

  6. linux内核情景分析之命名管道

    管道是一种"无名","无形文件,只可以近亲进程使用,不可以再任意两个进程通信使用,所以只能实现"有名","有形"的文件来实现就可以 ...

  7. linux内核情景分析之信号实现

    信号在进程间通信是异步的,每个进程的task_struct结构有一个sig指针,指向一个signal_struct结构 定义如下 struct signal_struct { atomic_t cou ...

  8. linux内核情景分析之强制性调度

    从系统调用返回到用户空间是否调度,从ret_with_reschedule可看出,是否真正调度,取决于当前进程的pcb中的need_resched是否设置为1,那如何设置为1取决于以下几种情况: 时间 ...

  9. linux内核情景分析之匿名管道

    管道的机制由pipe()创建,由pipe()所建立的管道两端都在同一进程.所以必须在fork的配合下,才可以在具有亲缘关系的进程通信 /* * sys_pipe() is the normal C c ...

随机推荐

  1. js过滤和包含数组方法

    let data=[{'Linda':'apple'},{'Linda':'pear'},{'Linda':'apricot'},{'Linda':'peach'},{'Linda':'grape'} ...

  2. 笔记-scrapy-Request/Response

    笔记-scrapy-Request/Response 1.     简介 Scrapy使用Request和Response来爬取网站. 2.     request class scrapy.http ...

  3. 理解线程3 c语言示例线程基本操作

    Table of Contents 1. 基本线程的动作 1.1. 设置线程属性 1.1.1. 设置脱离状态 1.1.2. 设置调度属性 1.2. 取消线程 1.3. 主线程创建多个线程示例 2. 了 ...

  4. imageX.exe

    imageX 编辑ImageX 是一个命令行工具,原始设备制造商 (OEM) 和公司可以使用它来捕获.修改和应用基于文件的磁盘映像以进行快速部署.ImageX 可以使用 Windows 映像 (.wi ...

  5. CentOS-6.3-minimal安装gnome桌面环境(转载)

    最近,想学着搞搞linux,从入门安装开始,先装centos6.3-minimal,发现是windowser最不习惯的命令界面,先升级桌面,教程如下. 1.添加一个普通用户,并设置密码useradd  ...

  6. Asp.net Core发布到CentOS7

    第一步.安装CentOS 官网https://www.centos.org/下载CentOS,下载地址https://www.centos.org/download/,我选的“DVD ISO”,然后虚 ...

  7. apache的/etc/httpd/conf/httpd.conf和/usr/local/apache2/conf/httpd.conf区别

    一.问题 centos系统用yum安装完apache后,重启后有时会失效,然后去网上找资料,发现有的说重启命令是这样的: /etc/init.d/httpd restart 而有的呢,说重启命令应该是 ...

  8. Python代码书写规范

    Python 编码规范 一 代码编排1 缩进.4个空格的缩进(编辑器都可以完成此功能),不要使用Tap,更不能混合使用Tap和空格.2 每行最大长度79,换行可以使用反斜杠,最好使用圆括号.换行点要在 ...

  9. [转载]有关如何入门ACM

    来源: 吴垠的日志 一些题外话 首先就是我为什么要写这么一篇日志.原因很简单,就是因为前几天有个想起步做ACM人很诚恳的问我该如何入门.其实就现在而言,我并不是很想和人再去讨论这样的话题,特别是当我发 ...

  10. maven学习(十六)——使用Maven构建多模块项目

    在平时的Javaweb项目开发中为了便于后期的维护,我们一般会进行分层开发,最常见的就是分为domain(域模型层).dao(数据库访问层).service(业务逻辑层).web(表现层),这样分层之 ...