版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。


livenessProbe在服务运行过程中检查应用程序是否运行正常,不正常将杀掉进程;而readness Probe是用于检测应用程序启动完成后是否准备好对外提供服务,不正常继续检测,直到返回成功为止









Liveness Analysis


Problem DescriptionnA program syntax is defined as below: nPROGRAM ::= STATEMENTS end '\n'nSTATEMENTS ::= STATEMENT STATEMENTS | epsilonnSTATEMENT ::= a [variable] '\n' | u [variable] '\n' | IF-CLAUSEnIF-CLAUSE ::= if '\n' STATEMENTS end '\n' | if '\n' STATEMENTS else '\n' STATEMENTS end '\n'nnIn which '\n' means the new line character, epsilon means an empty string, [variable] means a variable, which is represented by a number between 1 and n (inclusive). Same numbers denote the same variable. nThe program runs as follows: nIf the statement is "a [variable]", it assigns the variable a new value; nIf the statement if "u [variable]", it uses value of the variable to do something interesting; nIf there is an IF-CLAUSE, it is possible that condition of this clause is satisfied or not satisfied. nnWe only need to do liveness analysis on this program. This is why we do not explicitly write assigned values, what we do with the variables and condition of IF-CLAUSEs. nIn this task, there are three kinds of liveness for each of the variables. n1. Live. In one or more paths of this program, value of the variable at the beginning of the program is used. n2. Dead. In all paths of this program, the variable is assigned a new value before any use of this variable. n3. Half-dead. In all paths of this program, value of the variable at the beginning of the program is not used, but in one or more paths, the variable is never assigned a new value.n nnInputnFirst line, number of test cases, T. nFollowing are T test cases. For each test case, the first line is n, number of variables in the program. The following lines is the program. nnNumber of lines in the input <= 500000n nnOutputnT lines. Each line contains n numbers. If the variable is live, output 1; if the variable is dead, output -1; if the variable is half-dead, output 0.n nnSample Inputn10n1nendn1na 1nendn1nu 1nendn1na 1nu 1nendn1nu 1na 1nendn1nifna 1nelsena 1nendnendn1nifna 1nelsenu 1nendnendn1nifna 1nendnendn1nifnu 1nendnendn2na 1nu 2nendn nnSample Outputn0n-1n1n-1n1n-1n1n0n1n-1 1 问答